|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21077 proc_open hangs
Submitted: 2002-12-18 08:49 UTC Modified: 2003-07-16 03:55 UTC
From: Assigned:
Status: Closed Package: Program Execution
PHP Version: 4CVS-2003-07-15 (dev) OS: any BSD
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2002-12-18 08:49 UTC]
proc_open test in the testsuite fails.

Seems that proc_close fails now (returns -1).

Patch rev 1.85/1.86 on exec.c and related files triggered the bug.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-18 08:50 UTC]
assigning and marking on request
 [2002-12-19 14:36 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

 [2003-02-26 15:56 UTC] 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));

    while(!feof($pipes[1])) {
        echo fgets($pipes[1], 1024);
    // 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.
 [2003-07-15 09:51 UTC] webmaster at ragnarokonline dot de
It looks like, the bug has returned.

the test hangs on 
TEST_PHP_EXECUTABLE=sapi/cli/php \
sapi/cli/php -n run-tests.php \
 [2003-07-15 12:59 UTC]
Confirmed for PHP_4_3 on FreeBSD 4.8-STABLE.

Updating version, reopening.
cvs -DYesterday ext/standard/exec.c shows a rather large commit by moriyoshi, done 2003/07/13, concerning a leak fixer (MFH).

Removing assignment for now.
 [2003-07-15 16:32 UTC]
Can you confirm whether the commit by Moriyoshi caused this?

 [2003-07-15 18:59 UTC]
But then again, going back to, which contained the 
fix, also doesn't solve the problem. 
So, this is not just an ext/standard/exec.c issue, I'm 
Attaching with gdb, lands me anywhere from 
zend_parse_parameters to zend_get_opline(), so that's not 
very useful either. 
I can try some release tags tommorow to get a more exact 
location of the breaking commit. 
Need sleep now :) 
 [2003-07-16 03:55 UTC]
1) This test was bogus, fixed by hholzgra in 
2) The original test, was 
3) Both are working now. 
( 4) Why are these tests in different categories? ) 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 04:01:28 2024 UTC