> Basically, my question is.. how do I do this? I am actually (for
> various .. and probably stupid... reasons) trying to spawn a php
> process to run in the background. This process I know will take a
> couple of hours to run (mailing list stuff). I have been playing
> around with system to try to get it to run in the background but I
> can't seem to work out how to do it.

A process which generates output (or can generate output) will make the
system or exec call in blocking. That means that the PHP script will wait
until your script is finished. This can be simply fooled by adding ">
/dev/null" to your commandline (if you're running on a *nix based machine of
course).

I have a simple background process, which forks itself and then immediately
returns (only the parent process, the child keeps on running). Even then the
exec function was blocking, until I added "> /dev/null" to the commandline.
If you're background process doesn't spawn it's own child, I think you'll
have to add an ampersand (&) also, to make the program run in background.

HTH
Erwin


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

Reply via email to