title: PHP shell_exec() - Verbose Output?
body: <p>I have a Codeigniter project that uses Codeception for acceptance testing. I have a 'tools' controller setup in Codeigniter, which I use to store command line methods that perform various utility functions.</p>
  
  <p>In this case, I'm creating a utility method that sets up the testing environment, switches databases, builds / runs the tests, etc.</p>
  
  <p>I'm using the PHP function <code>shell_exec()</code> to run the codception commands.  They're working, however when <code>shell_exec()</code> issues the `php codecept.phar run' command, it's not providing verbose output.  It waits until all the tests are done (which takes a long time) and then spits out all the output at the end.</p>
  
  <p>Is there a way to have shell_exec() print the output as it receives it?</p>
  
  <p>example code:</p>
  
  <pre><code>public function run_tests() 
  { 
       $this-&gt;load-&gt;database('testing'); 
       echo shell_exec("cd ..; php codecept.phar build"); 
       echo shell_exec("cd ..; php codecept.phar run"); 
  }
  </code></pre>