Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

up vote 2 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

 
discard

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.