How to start script in the background (using exec())?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!


I have some troubles trying to start php script using exec() and leave
it running in the background.

Manual says: "If you start a program using this function and want to
leave it running in the background, you have to make sure that the
output of that program is redirected to a file or some other output
stream or else PHP will hang until the execution of the program ends."

So, I'm doing this:
exec("/usr/local/bin/php /mydir/myscript.php >/dev/null 2>/dev/null

I don't recieve any output from "child" script, but "parent" script
waits until "child" is doing its work.

What should I do to achive my goal?


Site Timeline