random 502 gateway errors with nginx php-fpm and ubuntu

vitty95

New Member
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.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.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.\[code\]// !!! 502 Gateway Error (unhappy server)error_reporting = E_ALL & E_NOTICE; error_log = php_errors.log (note this is commented)// Happy Server, no 502 gateway errorerror_reporting = E_ALL & E_NOTICEerror_log = /valid/log/path/and/permissions// Happy Server, no 502 gateway errorerror_reporting = E_CORE_ERROR; error_log = php_errors.log (note this is commented)\[/code\]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.Also note, that 502 gateway errors were not being triggered on every php notice.Hope this saves someone some frustration!
 
Back
Top