With FastCGI & default PHP, if you have PHP display_errors turned off (which in production you should), your server will return a blank HTTP status Code 200 page, with no information to the end user as to what happened.
A new php.ini directive has been added with php-frm (Due to be incorporated into PHP Trunk in the near future)
How to correctly return a 500 Server Error Code rather than a blank 200
Either:
- Add to your main php.ini via eg /usr/local/lib/php.ini
- Or directly into the /etc/php-frm.conf
PHP.ini
fastcgi.error_header=”HTTP/1.1 500 Internal Server Error”
/etc/php-frm.conf
Add the directive below this line – <value name=”php_defines”>
<value name=”fastcgi.error_header”>HTTP/1.1 500 Internal Server Error</value>
Restart PHP-FRM (via /etc/init.d/php-frm)
So long as your server has either one of the following, you’ll see the effect immediately
- error_page 500 /50x.htm (In nginx)
- ErrorDocument 500 /50x.htm (In Apache)
Related posts:
- Xdebug in PHP Xdebug in PHP is speeding up my debuging of code....
Related posts brought to you by Yet Another Related Posts Plugin.