Problems with proc_open and getmypid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I'm developing a PHP application that runs on GNU/Linux with php cli. A
process must launch another one and store its pid, so I use proc_open
and then proc_status to achieve that.

The child process must also get its own pid and write it down to a file.

After that, the calling process should compare both pids and they should
match, but in fact they shoudln't.

The problem is that when calling to proc_open like:

$res = proc_open ("/usr/bin/php proc2.php", array(), $pipes);

Two processes are created, one for the sh shell that launchs the php
interpreter, and another for the php interpreter itself. Also, it seems
like proc_get_status($res) returns the status of the sh, while getmypid
in the second process returns the pid of the php interpreter.

I wonder if there's anyway of do something of these:

a) Get the pid of the php interpreter on proc_open instead of the sh one
on the parent process, or...

b) Get the pid of the sh process instead of the php interpreter on the
child process.

Or any manner in which two pids matches.

Thanks a lot in advance,

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux