October 16, 2012

PHP-FPM Error Logging To Nginx

We’ve finally moved all of our sites, at Primary Technology, over to Nginx/PHP-FPM from Apache. Our developers had a problem with the error logging that PHP-FPM does by default, as it goes into one file making debugging difficult. You can however log all errors to the Nginx logs as follows.


catch_workers_output = yes


log_errors = On
error_log = /dir/you/want/to/use/for/logging.log


# The final "error" text at the end of the next line is crucial
# You can also use any of the following in it's place:
# "debug | info | notice | warn | error | crit | alert | emerg"
error_log /dir/to/your/nginx/site.log error;

Leave a Reply

Your email address will not be published. Required fields are marked *