Welcome! Log In Create A New Profile

Advanced

How to prevent Nginx from capturing errors from FastCGI/PHP-FPM?

Posted by hereyk 
How to prevent Nginx from capturing errors from FastCGI/PHP-FPM?
July 07, 2016 05:28PM
I'm using Nginx 1.8.1 as a reverse proxy in front of PHP 5.6.20 over FastCGI (PHP-FPM), and I'm finding that all the notice/warning/error logs from PHP are also being logged in Nginx as errors. Is there any way to prevent such logs from propagating to Nginx' logs? I want them logged in PHP's log file only.

Here's an example:

[29-Apr-2016 22:23:10] WARNING: [pool www] child 20 said into stderr: "NOTICE: PHP message: PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /opt/web-app/index.php on line 2"

That same log is them added to Nginx' log file as an error:

2016/04/29 22:23:10 [error] 6#0: 1 FastCGI sent in stderr: "PHP message: PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings. You are *required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /opt/web-app/index.php on line 2" while reading response header from upstream, client: 172.18.0.1, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://172.18.0.2:9000", host: "localhost:8080", referrer: "http://localhost:8080/index.php"

Is there any change that I can make to my very simple configuration files for Nginx or PHP-FPM?
https://github.com/gnarea/docker-alpine-php-fpm/blob/master/nginx.conf.template
https://github.com/gnarea/docker-alpine-php-fpm/blob/master/php-fpm.conf

Thanks in advance!
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 182
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready