By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,558 Members | 1,373 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,558 IT Pros & Developers. It's quick & easy.

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

P: n/a

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?

Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.