title: How to execute shell commands synchronously in PHP
body: <p>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</p>
  
  <pre><code>exec ("php phpscript1.php ");
  exec ("php phpscript2.php ");
  exec ("php phpscript3.php ");
  exec ("php phpscript4.php ");
  exec ("php phpscript5.php ");
  </code></pre>
  
  <p>I think these scripts run asynchronously, any suggestion guys so that these scripts can be run synchronously.</p>