title: How to run shell script with live feedback from PHP?
body: <p>How would I execute a shell script from PHP while giving constant/live feedback to the browser?
  I understand from the <a href="http://php.net/manual/en/function.system.php" rel="nofollow">system</a> function documentation:</p>
  
  <blockquote>
    <p>The system() call also tries to automatically flush the web server's
    output buffer after each line of output if PHP is running as a server
    module.</p>
  </blockquote>
  
  <p>I'm not clear on what they mean by running it as a 'server module'.</p>
  
  <p>Example PHP code:</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  system('/var/lib/script_test.sh');
  </code></pre>
  
  <p>Example shell code:</p>
  
  <pre class="lang-sh prettyprint-override"><code>#!/bin/bash
  
  echo "Start..."
  for i in {1..10}
  do
          echo "$i..."
          sleep 1
  done
  echo "Done."
  </code></pre>
  
  <p><strong>What this does:</strong> It will wait about 10 seconds and then flush to the output buffer.</p>
  
  <p><strong>What I want this to do:</strong> Flush to the output buffer after each line of output.</p>