When PHP Fatal error occurs, Nginx reports HTTP Error 500 to browser

My server is configured using Nginx + PHP + FastCGI. Whenever PHP generates a fatal error, it is logged inside nginx / error.log, but the server reports HTTP Error 500 back to the browser instead of displaying PHP Fatal error in the browser, as is desirable and typical of other settings. I was looking for how to solve this problem, and not fall behind. Does anyone have anything useful? Really appreciate!

+4
source share
2 answers

Found it!

Starting with PHP 5.2.4, the default value now causes a 500 error , since the alternative is a blank page.

Other discussions show that this behavior cannot be changed for the type of error "PHP Fatal", which do not go through the normal procedures of the error handler and cannot be caught or stopped.

+7
source

You probably have php_errors (or their display) in your php script loader ... Try checking php.ini settings ...

+2
source

Source: https://habr.com/ru/post/1343840/


All Articles