#22458 [Opn->Fbk]: Proc_open hangs
| From: | wez@php.net | Date: | Thu, 27 Feb 2003 16:34:55 +0000 |
| Subject: | #22458 [Opn->Fbk]: Proc_open hangs | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-34449@lists.php.net to get a copy of this message | ||
ID: 22458
Updated by: wez@php.net
Reported By: jlondon at mail dot mcg dot edu
-Status: Open
+Status: Feedback
Bug Type: IIS related
Operating System: Windows NT Server 4.0
PHP Version: 4.3.0
New Comment:
Please try using the following for the command string:
"C:\\php\\cli\\php.exe"
Previous Comments:
------------------------------------------------------------------------
[2003-02-27 10:30:32] jlondon at mail dot mcg dot edu
No change...still runs like mad and crashes IIS. I can't even do a
"net stop". I'm running the CGI version if that makes any difference.
Also I have to refer to php as c:/php/php otherwise error-output.txt
has the message "he name specified is not recognized as an internal or
external command, operable program or batch file."
------------------------------------------------------------------------
[2003-02-27 08:51:50] iliaa@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
------------------------------------------------------------------------
[2003-02-27 08:26:25] jlondon at mail dot mcg dot edu
proc_open hangs on the example that is in the manual. Here is the
code.
$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will
read from
1 => array("pipe", "w"), // stdout is a pipe that the child will
write to
2 => array("file", "c:/temp/error-output.txt", "a"), // stderr
is a
file to write to
);
$process = proc_open("c:\php\php.exe", $descriptorspec, $pipes);
if (is_resource($process)) {
// $pipes now looks like this:
// 0 => writeable handle connected to child stdin
// 1 => readable handle connected to child stdout
// Any error output will be appended to /tmp/error-output.txt
fwrite($pipes[0], "<?php echo \"Hello World!\"; ?>" . chr(3));
fclose($pipes[0]);
while(!feof($pipes[1])) {
echo fgets($pipes[1], 1024);
}
fclose($pipes[1]);
// It is important that you close any pipes before calling
// proc_close in order to avoid a deadlock
$return_value = proc_close($process);
echo "command returned $return_value\n";
}
I'm running NT4 Server/PHP4.3.2.2/IIS4. This bit of code opened up 54
php.exe/cmd.exe (that's 54 of each or 108 total) processes on my
machine.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22458&edit=1