Reply to how to use proc_open and a non-standard file descriptor

Your name:

Reply:


Posted by darrin.skinner on 02/06/06 09:50

Hi all,

[Note: I'm doing this in Windows...]

How can I open a file/pipe to something other than STDOUT/STDERR? I.e.
I want to write to file descriptor # 3. fopen("php://std3"... does not
work. fopen("/dev/ttyS3"... does not work. Any ideas?

For more detail on what I'm trying to do, its' something like this...
-------------------------------------
PARENT PROGRAM.....
$descriptorspec = array(
//0 => array("pipe", "r"), // stdin is a pipe that the child will
read from
1 => array("file", "pgm_output.log","a"), // stdout is a file the
child will write to
2 => array("file", "/tmp/error-output.txt", "a"), // stderr is a
file to write to
3 => array("pipe", "w") // This is a special file descriptor the
program will use to signal success
);

$process = proc_open('child_program.php', $descriptorspec, $pipes);
if (is_resource($process)) {
echo stream_get_contents($pipes[3]);
fclose($pipes[3]);

... etc, etc.
}
-------------------------------------
CHILD PROGRAM......
$fh = popen("php://STD3", "w"); <<--- HOW DO I CODE THIS TO
CONNECT TO
<<-- THE #3
$descriptorspec in the parent program?
fwrite($fh, "Job Finished");
pclose($fh);
-------------------------------------
Thanks,
Darrin

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация