title: How do I execute a system command that requires user input and see the output in real time?
body: <p>When I run the following command and keep providing an empty passphrase:</p>
  
  <pre><code>mount -t ecryptfs /to/be/mounted /mount/location
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>Passphrase:
  Wrong input, non-empty value required!
  Passphrase:
  Wrong input, non-empty value required!
  Passphrase:
  Wrong input, non-empty value required!
  </code></pre>
  
  <p>That's great!  But when I try doing the same from a PHP script with the following code:</p>
  
  <pre><code>#!/usr/bin/php
  &lt;?php
          system("mount -t ecryptfs /to/be/mounted /mount/location");
  ?&gt;
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>Wrong input, non-empty value required!
  Wrong input, non-empty value required!
  Wrong input, non-empty value required!
  Passphrase:
  Passphrase:
  Passphrase:
  </code></pre>
  
  <p>Not great!  How do I get PHP to display the output in the right order, at the right time?</p>