Help with exec()
Posted: Sat Nov 08, 2008 3:13 pm
--------------------------------------------------------------------------------
Hi,
I want my php script (a.php) to call another script (b.php) and run it in background mode.
This is what I use in a.php:
exec ("/usr/bin/php b.php >/dev/null &");
And this is what I place in b.php (among other commands):
sleep(30)
When I run a.php, it calls b.php, which makes the script wait for 30 seconds.
Imagine that during those 30 seconds, the script a.php in the same http session calls the exec above for a second time.
It appears that the second call is ignored, as if the first "process" needs to be completed before b.php can be invoked again.
Is it possible to call b.php multiple times in multiple independent threads, so each of them can have a different outcome?
Thanks
Hi,
I want my php script (a.php) to call another script (b.php) and run it in background mode.
This is what I use in a.php:
exec ("/usr/bin/php b.php >/dev/null &");
And this is what I place in b.php (among other commands):
sleep(30)
When I run a.php, it calls b.php, which makes the script wait for 30 seconds.
Imagine that during those 30 seconds, the script a.php in the same http session calls the exec above for a second time.
It appears that the second call is ignored, as if the first "process" needs to be completed before b.php can be invoked again.
Is it possible to call b.php multiple times in multiple independent threads, so each of them can have a different outcome?
Thanks