title: How do I log every output from a PHP script from the command line?
body: <p>I'm running a PHP script and want to log all output from the program to a single log file via the command line. This is what I'm doing now when I execute the script.</p>
  
  <pre><code>php generate_production_persons.php 1 10000 2&gt;&amp;1 &gt; log
  </code></pre>
  
  <p>Error/Notice/Etc. messages don't redirect to my <code>log</code> file. They still just output to the screen where the script is running.</p>
  
  <p>I don't want to log from within my script. I just want to be able to write all of this to a log file whenever I run a PHP script from the command line. I want the output in the <code>log</code> file to look exactly as it looks from the CLI where it's running had I not redirected the output to a log file.</p>