4

My server is setup with Nginx + PHP + FastCGI. Whenever PHP throws a Fatal error, it gets logged inside of nginx/error.log, but the server reports HTTP Error 500 back to the browser instead of displaying the PHP Fatal error to the browser as is desired and typical in other setups. I've been searching for how to resolve this and keep coming up short. Anyone have anything helpful about this? Much appreciated!

OCDev
  • 2,280
  • 3
  • 26
  • 37
  • 1
    Do you have `display_errors` enabled? – Charles Mar 15 '11 at 20:27
  • display_errors is set to "On" in php.ini, and I made sure it was the only php.ini on the system – OCDev Mar 15 '11 at 20:54
  • What FastCGI process manager are you using, and what PHP version? – Charles Mar 15 '11 at 21:23
  • PHP 5.3.2. Plain old FastCGI that needs to be started using this command: php-cgi -b 127.0.0.1:9000 & – OCDev Mar 17 '11 at 04:07
  • 1
    Hm. What's the value of the ini setting `fastcgi.logging`? Are you able to update to 5.3.3 or better and try the [new, built-in FPM FastCGI interface](http://php.net/manual/en/install.fpm.php)? – Charles Mar 17 '11 at 04:21
  • ;fastcgi.logging = 0 (it is commented out), yeah I'll probably be on FPM FastCGI when time comes for production phase of the app. – OCDev Mar 17 '11 at 18:22
  • Darn. Well, outside of that setting, I'm not entirely sure. It could be that the fatal error is going to stdout/stderr instead of to the socket, or that it's going to the socket, but it's being interpreted oddly by FastCGI. – Charles Mar 17 '11 at 19:34

2 Answers2

7

Found it!

As of PHP 5.2.4, the default is now to cause a 500 error, because the alternative is an empty page.

Other discussions suggest that this behavior can not be changed for the "PHP Fatal" error type, which don't flow through the normal error handler routines and can not be caught or stopped.

Community
  • 1
  • 1
Charles
  • 50,943
  • 13
  • 104
  • 142
2

You probably have php_errors off (or the displaying of them) in your php loader script... Try checking your php.ini settings...

Gekkie
  • 996
  • 9
  • 24
  • 1
    display_errors is set to "On" in php.ini, and I made sure it was the only php.ini on the system – OCDev Mar 15 '11 at 20:55