title: PHP Exec: Without Waiting, Without Discarding the Output, Without nohup
body: <p>I need to run a command in PHP like this:</p>
  
  <pre><code>exec('dosomething &gt; saveit.txt');
  </code></pre>
  
  <p>Except I don't want PHP to wait for it to be complete. I also don't want to throw away the output, and I don't want to use nohup because I'm using that for something else in the same directory.</p>
  
  <p>I also tried <code>pclose(popen('dosomething &gt; saveit.txt','r'));</code> and that didn't work, it still waited.</p>