-1

I am using Nginx + php7.0-fpm. Some of my errors (500 code) go into the status code header. In the browser console I see, for example, such a message:

POST https://example.com 500 (DateTime::__construct(): Failed to parse time string (2017-04-09 :) at position 11 (:): Unexpected character)

I tried disabling error reporting, display_errors = off does not work as well – errors go to the header, and they are never logged. The nginx error log is clear. But not all errors are risen like that – most of them are handled correctly. I have the fastcgi_intercept_errors directive enabled in the nginx.conf.

When I switch back to php5, I do not see such behaviour. The problem is only when I use php7.0. Can't figure out how to make errors go into the log instead of the browser console.

El cero
  • 101
  • 1
  • 3

2 Answers2

0

I am not familiar with PHP7, but when nginx receives a message over the STDERR channel of the FastCGI interface, it will write it to its error log.

You should check your PHP configuration files. It is common to log PHP errors to a separate logfile, but if you must send these error messages to nginx try changing the display_errors variable to stderr.

See this link for more.

Richard Smith
  • 11,859
  • 2
  • 18
  • 26
0

Check if You have set error_log in php.ini. Also You can add following to .conf file as PHP7 has some stupid defaults

catch_workers_output = yes

php_flag[display_errors] = off
php_admin_value[error_log] = /var/log/fpm-php.www.log
php_admin_flag[log_errors] = on