Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
You could also just set php's error log to the same file as the nginx one. – Patrick James McDougle Dec 19 '14 at 21:39
up vote 4 down vote accepted

You need to make two changes:

  1. Unset PHP's error_log directive in php.ini. This will cause it to log to standard error, which nginx will then log to its own error log.
  2. Set catch_workers_output = yes in your php-fpm configuration php-fpm.conf, to ensure that the FPM SAPI doesn't discard standard error.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.