Mastering Development System & Network

I WANT to display PHP errors but PHP-FPM causing 503 + “Failed to read FastCGI header” in apache

I’ve built an error handler for my PHP app to gracefully and intelligently display errors based on the current user rights, which worked great when I was just using straight up Apache (httpd)…. which is to say the following isn’t anything to do with the standard stuff like display_errors = On or setting the error level to E_ALL.

When I moved to PHP-FPM, I’m now getting 503 Server Unavailable when there’s a coding error, and in the logs Failed to read FastCGI header, with Apache’s generic error screen, rather than my handler.

My errors are still logged properly in the DB the way I expect them to from the handler, but I’m no longer getting pretty feedback and have to look at the DB every time I need to dubug something, it’s a PITA.

I haven’t been able to find an answer relating to this because most people want to hide their errors, not display them the way I do, so there’s too much static. I KNOW the error is in my PHP code when this comes up, this is not my issue, I just want the output to be displayed rather than a generic 503 error message.

If I add a handler to the httpd.conf like:

errordocument 503 /error.php

the error.php page shows, but I want the direct output from the handler, not a redirect. If there was for instance a DB error and it couldn’t write the error to my log table, then I need to see the output immediately with all the trace info available.

I’m assuming this is a missing / misconfigured conf setting in httpd.conf, so if anyone can help shed light, I’d appreciate it!

Leave a Reply

Your email address will not be published. Required fields are marked *