title: random 502 gateway errors with nginx php-fpm and ubuntu
body: <p>I was having an issue with random 502 gateway errors using nginx and php-fpm. In my case I discovered a scenario where various php.ini error_log settings and error_reporting levels were causing the random 502 gateway errors to appear.</p>
  
  <p>By changing the php.ini settings error_reporting and error_log I was able to make the 502 gateway errors disappear - but more importantly I was able to see what the real php errors were in the log and fix them.</p>
  
  <p>The main issue was that if "error_reporting was set to display notices, "error_logging = On" then I needed make sure that error_log was set to a valid path tat was writable to the server.</p>
  
  <pre><code>// !!! 502 Gateway Error (unhappy server)
  error_reporting = E_ALL &amp; E_NOTICE
  ; error_log = php_errors.log (note this is commented)
  
  // Happy Server, no 502 gateway error
  error_reporting = E_ALL &amp; E_NOTICE
  error_log = /valid/log/path/and/permissions
  
  // Happy Server, no 502 gateway error
  error_reporting = E_CORE_ERROR
  ; error_log = php_errors.log (note this is commented)
  </code></pre>
  
  <p>Note, the actual errors were php notices... however ngingx was throwing 502 gateway errors for php notices that were related to properties not being set.</p>
  
  <p>Also note, that 502 gateway errors were not being triggered on every php notice.</p>
  
  <p>Hope this saves someone some frustration!</p>