note 82951 added to function.proc-open
| From: | jonah at whalehosting dot ca | Date: | Sat, 03 May 2008 05:22:15 +0000 |
| Subject: | note 82951 added to function.proc-open | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139018@lists.php.net to get a copy of this message | ||
@joachimb: The descriptorspec describes the i/o from the perspective of the process you are opening.
That is why stdin is read: you are writing, the process is reading. So you want to open descriptor
2 (stderr) in write mode so that the process can write to it and you can read it. In your case
where you want all descriptors to be pipes you should always use:
<?php
$descriptorspec = array(
0 => array('pipe', 'r'), // stdin
1 => array('pipe', 'w'), // stdout
2 => array('pipe', 'w') // stderr
);
?>
The examples below where stderr is opened as 'r' is a mistake.
I would like to see examples of using higher descriptor numbers than 2. Specifically GPG as
mentioned in the documentation.
----
Server IP: 209.41.74.194
Probable Submitter: 69.254.0.26
----
Manual Page -- http://www.php.net/manual/en/function.proc-open.php
Edit -- https://master.php.net/note/edit/82951
Del: integrated -- https://master.php.net/note/delete/82951/integrated
Del: useless -- https://master.php.net/note/delete/82951/useless
Del: bad code -- https://master.php.net/note/delete/82951/bad+code
Del: spam -- https://master.php.net/note/delete/82951/spam
Del: non-english -- https://master.php.net/note/delete/82951/non-english
Del: in docs -- https://master.php.net/note/delete/82951/in+docs
Del: other reasons-- https://master.php.net/note/delete/82951
Reject -- https://master.php.net/note/reject/82951
Search -- https://master.php.net/manage/user-notes.php