Function like exec() without waiting for execution

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nextguy
Forum Newbie
Posts: 1
Joined: Thu Oct 02, 2008 6:22 pm

Function like exec() without waiting for execution

Post by nextguy »

Hi all,

im looking for a function like exec() or system() that will not wait until the command is executed? I could not find any function in the manual that has this behavior.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Function like exec() without waiting for execution

Post by josh »

invoke the command thru nohup ( launches linux processes immune to a hangup signal )

syntax

nohup ./command > output.out &

you should redirect the output somewhere, and the & tells the process to run in the background. Technically what you need is the & not the nohup, but the nohup would stop that process from dying if apache got restarted or something
Post Reply