0

Imagine for a second you have the following php based page served via apache + mod_php :

<?
blahblah!!!_!_!(___);
?>

This is obviously invalid php, and the script would fail.

Is there any way to signal to mod_php / apache / php.ini (?) to issue a 5xx based status code + document body when this happens?

Ideally one that I could edit / create on my own...

Thanks!

1 Answer 1

1

Your best bet is to look at defining custom error handlers and a shutdown function in PHP to do this for you.

You would just capture the error, and you could then send custom 5XX error header and whatever additional content (i.e. custom error page) you desire.

The following links in the PHP manual should get you what you need.

set_error_handler manual

register_shutdown_function manual

header manual

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.