When I am using apache/mod_php, the PHP error will appear in the apache’s error log.
Now, I am using php-fpm with nginx via fcgi, is it possible to have the PHP error log in the nginx error log as well?
So far the only solution is to use external file as defined in the php.ini
error_log = /tmp/php_errors.log
But I want them in the nginx error log for the ease of maintenance.
You need to make two changes:
- Unset PHP’s
php.ini. This will cause it to log to standard error, which nginx will then log to its own error log.
catch_workers_output = yesin your php-fpm configuration
php-fpm.conf, to ensure that the FPM SAPI doesn’t discard standard error.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.