I'm trying to setup a php trigger file that will set off a background process. (see this question)
I'm doing this on a Windows Wampserver environment.
So for example I have
trigger.php that runs the exec function that calls for my
backgroundProcess.php to be parsed and executed.
However the problem is that my
trigger.php file is waiting for the
exec() command to finish running
backgroundProcess.php before it stops. The background process runs for about 20-30 seconds, and
trigger.php is waiting all that time until
backgroundProcess.php has fully finished.
Is that making sense? Here is the
trigger.php file that runs the
exec('C:wampbinphpphp'.phpversion().'php.exe -f C:pathtobackgroundProcess.php > C:wampbinphpphp'.phpversion().'devnull &');
Basically, I'm wanting
trigger.php to just trigger off the backgroundProcess and not wait around for it to finish.
Problem solved with the following command:
$WshShell = new COM("WScript.Shell"); $oExec = $WshShell->Run("C:wampbinphpphpVERSIONNUMBERphp-win.exe -f C:/wamp/www/path/to/backgroundProcess.php", 0, false);