title: How do I get PHP to log a stacktrace upon fatal error
body: <p>I have configured php to log errors and on my development machine, they show up in the apache error logs as:</p>
  
  <pre><code>[Thu Mar 17 18:22:07 2011] [error] [client ::1] PHP Parse error:  syntax error, unexpected ')' in /Users/troelskn/Projects/test/bootstrap.inc.php on line 27
  [Thu Mar 17 18:22:07 2011] [error] [client ::1] PHP Stack trace:
  [Thu Mar 17 18:22:07 2011] [error] [client ::1] PHP   1. {main}() /Users/troelskn/Projects/test/public/index.php:0
  </code></pre>
  
  <p>However, on the production machines (Ubuntu) there is no stacktrace following the error and there is a referrer attached to the message. Eg. it would look like:</p>
  
  <pre><code>[Thu Mar 17 18:22:07 2011] [error] [client ::1] PHP Parse error:  syntax error, unexpected ')' in /Users/troelskn/Projects/test/bootstrap.inc.php on line 27, referer: http://localhost/
  </code></pre>
  
  <p>How can I control this formatting? I would very much like to have the stacktrace available in the logs.</p>