|  | 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
  Navigation: [Reply to this message] |