title: shell script not being invoked via php and completion status running shell script in php
body: <p>I am using php to control(start/stop) my servers. Inside php I am using shell_exec, which runs shell script and start/stop the server. Following is the code for button and further action upon button click.</p>
  
  <pre><code>&lt;table&gt;&lt;tr&gt;&lt;td&gt;Server1&lt;/td&gt;&lt;td&gt;&lt;form method="post"&gt;&lt;input type="submit" class="btn btn-primary btn-xs" name ="start_as" value="start"/&gt;
  &lt;/form&gt;
  &lt;?php
  function startAS()
  {
  shell_exec("/$path/startASServer.sh");
  }
  if(array_key_exists('start_as',$_POST)){
     startAS();
  }
  ?&gt;
  &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  </code></pre>
  
  <p>and below my sh file:</p>
  
  <pre><code>ssh user@ip "nohup /$path/startASServer.sh &gt; /dev/null 2&gt;&amp;1 &amp;"
  SERVER=ip1 PORT=port1
  while !(: &lt; /dev/tcp/$SERVER/$PORT) 2&gt;/dev/null
  do
      echo "* Waiting for  Server to Start *"
  done
  echo "Server is Started"
  </code></pre>
  
  <p>The problem is when I click on "start" button, the browser hangs and  I can not see shell script being run on server, request expert guidance here. Also, if there is anyway wherein I can show two updates in popup window showing task started and task completed.</p>
  
  <p>Thanks</p>