How can I get php to return 500 upon encountering a fatal exception?

Mike picture Mike · Oct 12, 2009 · Viewed 64.9k times · Source

PHP fatal errors come back as status code 200 to the HTTP client. How can I make it return a status code 500 (Internal server error)?

Answer

Chris Jester-Young picture Chris Jester-Young · Oct 12, 2009
header("HTTP/1.1 500 Internal Server Error");