PHP-FPM doesn't write to error log
Solution 1:
This worked for me:
; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs.
; Default Value: no
catch_workers_output = yes
Edit:
The file to edit is the file that configure your desired pool. By default its: /etc/php-fpm.d/www.conf
Solution 2:
I struggled with this for a long time before finding my php-fpm logs were being written to /var/log/upstart/php5-fpm.log
. It appears to be a bug between how upstart and php-fpm interact. See more here: https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1319595
Solution 3:
I had a similar issue and had to do the following to the pool.d/www.conf
file
php_admin_value[error_log] = /var/log/fpm-php.www.log
php_admin_flag[log_errors] = on
It still wasn't writing the log file so I actually had to create it by touch /var/log/fpm-php.www.log
then setting the correct owner sudo chown www-data:www-data /var/log/fpm-php.www.log
.
Once this was done, and php5-fpm restarted, logging was resumed.