I need to run multiple scripts(5 scripts) via cmd, I want to make sure unless and until the first script finishes the second should not initiate. Thus after first script completes then only second should being then third one and so on.. Currently I am using the following code to do this
exec ("php phpscript1.php "); exec ("php phpscript2.php "); exec ("php phpscript3.php "); exec ("php phpscript4.php "); exec ("php phpscript5.php ");
I think these scripts run asynchronously, any suggestion guys so that these scripts can be run synchronously.
PHP exec will wait until the execution of the called program is finished, before processing the next line, unless you use & at the end of the string to run the program in background.