tags:

views:

242

answers:

2
php file.php &

How to get PID of the background process in file.php?

+1  A: 

I believe you're looking for the function getmypid()

http://php.net/manual/en/function.getmypid.php

posix_getpid() seems to do the same thing...

http://php.net/manual/en/function.posix-getpid.php

Josh
Fatal error: Call to undefined function `posix_getpid()`
Hm. Well apparently they're not exactly the same :-) I'm glad one of them worked.
Josh
+1  A: 

getmypid() does what you need.

Emil Ivanov