At the moment I have a line of code like this:
system("/usr/bin/php myphpscript.php --param=".val);
Is there a way to make php not wait for the script to finish - and just move on instead?
It's a loop moving email, and the myphpscript.php is parsing the mails. And I don't wan't to wait for myphpscript.php to finish each time - just start it and move on!
UPDATE SOLUTION
Found the answer here:
http://www.php.net/manual/en/function.exec.php#101506
passthru("/usr/bin/php myphpscript.php --param=".val." >> /dev/null 2>&1 &");
Exp:
/dev/null
I needed to write to something else that STDOUT, else PHP will hang untill script finish. So I write to /dev/null instead.
2>&1
Redirecting errors to STDOUT
&
"Run in background" as mentioned in this thread.
Have a good day!
jack
jack