ID: 40070
Updated by: [EMAIL PROTECTED]
Reported By: kyle at videoegg dot com
-Status: Open
+Status: Bogus
Bug Type: Program Execution
Operating System: Windows XP SP2
PHP Version: 5.2.1RC2
New Comment:
it returns the PID of cmd.exe, as in the linux implementation. However
if you set the last parameter as array('bypass_shell' => true), you'll
get the PID of the program, because you are bypassing the shell.
Previous Comments:
------------------------------------------------------------------------
[2007-01-09 01:46:09] kyle at videoegg dot com
Description:
------------
This is identical to Bug #38542
There still seems to be an issue with this. I have upgraded my PHP
installation to "PHP 5.2.1RC3-dev (cli) (built: Jan 9 2007 00:24:29)"
on Windows and I am getting the wrong PID returned.
proc_get_status returns 2976 for the PID while the script that is being
executed sees its PID as 3768 from getmypid().
Additionally, "tasklist" from the command line returns:
php.exe 3768 Console 0 9,084 K
Reproduce code:
---------------
pid.php
<?php
$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("pipe", "w") // stderr is a pipe that the child will
write to
);
$resource = proc_open('php -f pid_output.php', $descriptorspec,
$pipes);
$stats = proc_get_status($resource);
$handle = fopen("pid.dat", "a");
fwrite($handle, "Parent: " . $stats['pid'] . "\n");
fclose($handle);
?>
pid_output.php
<?php
$handle = fopen("pid.dat", "a");
fwrite($handle, "Child: " . getmypid() . "\n");
fclose($handle);
?>
Expected result:
----------------
Parent: 3480
Child: 3480
Actual result:
--------------
Parent: 3224
Child: 3480
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40070&edit=1