Page 1 of 1

multiple exec statements - run each prog in bg - no waiting

Posted: Wed Jan 23, 2008 7:04 am
by dickey
I have a script the likes of

Code: Select all

 
// launcher.php
exec("externalprog1.bat",$output);// externalprog1.bat contains a single line like-->@C:\php\php.exe -q process1.php
exec("externalprog2.bat",$output);// externalprog2.bat contains a single line like-->@C:\php\php.exe -q process2.php
exec("externalprog3.bat",$output);// externalprog3.bat contains a single line like-->@C:\php\php.exe -q process3.php
exec("externalprog4.bat",$output);// externalprog4.bat contains a single line like-->@C:\php\php.exe -q process4.php
 
Currently, when launcher.php is run, only the first external program is executed (although I have run each batch file from the cmd line successfully).

What I would like to happen is to have each external program run immediately as a background process, and not wait until externalprog1 is finished before executing externalprog2 etc.

I simply want to execute them all no waiting.

PHP5.2.0/Apache2.2/WinXPPro SP2 (by way of background).

Thanks and kind regards, Andrew

Re: multiple exec statements - run each prog in bg - no waiting

Posted: Wed Jan 23, 2008 7:20 am
by VladSun

Re: multiple exec statements - run each prog in bg - no waiting

Posted: Thu Jan 24, 2008 5:20 am
by dickey
Thanks Vladsun, your recommended view topic was most helpful. I can now exec multiple programs as background processes quickly and return control to the main script.

Kind regards,

Andrew