Gary C. New
2003-11-21 10:40:05 UTC
What is the best way to detach and run a command line based php script
in the background from a web-based php script, without the need for
reporting?
I have a web-based php script that gathers information and then passes
it off to several functions, which execute several other php scripts.
The problem is that the main php script does not return until all the
processes have signaled and is taking about 30 sec to complete. There
is no need for the child processes spawned by the main php script to
signal. I would like to spawn and detach them to finish in the
background; thus, dramatically reducing the load time of the main php
script.
It has been suggested to me to use the & with the shell_exec function,
but this still requires the child processes to signal.
Another suggestion was to use the pcntl_fork function, but my reading
suggest that this is not to be used with web-based applications and does
not compile in with mod_php (only the binary version). If I were to use
the binary version would I even be able to detach the forked child
processes? Doesn't pcntl_fork still require the child processes to
signal to the parent before exiting otherwise becoming zombie processes?
Any suggestions on the best way to handle this?
Respectfully,
Gary
in the background from a web-based php script, without the need for
reporting?
I have a web-based php script that gathers information and then passes
it off to several functions, which execute several other php scripts.
The problem is that the main php script does not return until all the
processes have signaled and is taking about 30 sec to complete. There
is no need for the child processes spawned by the main php script to
signal. I would like to spawn and detach them to finish in the
background; thus, dramatically reducing the load time of the main php
script.
It has been suggested to me to use the & with the shell_exec function,
but this still requires the child processes to signal.
Another suggestion was to use the pcntl_fork function, but my reading
suggest that this is not to be used with web-based applications and does
not compile in with mod_php (only the binary version). If I were to use
the binary version would I even be able to detach the forked child
processes? Doesn't pcntl_fork still require the child processes to
signal to the parent before exiting otherwise becoming zombie processes?
Any suggestions on the best way to handle this?
Respectfully,
Gary
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php