TheLexoPlexx
TheLexoPlexx

Reputation: 117

Dynamic Catch of Server Errors with PHP

my answer is quite simple: Is there a way to catch server-errors (like Error 400, 401, 403, 404, 500...) automatically with PHP and generate custom Error-Pages.

For example, let's say I got a PHP-File with the page and it just inserts the Error-Code and the Error-Message.

Thanks in advance!

Upvotes: 3

Views: 177

Answers (2)

Nick
Nick

Reputation: 10143

You may use custom exception handler function (set_exception_handler()) and error handler (set_error_handler()) for turn errors to Exception (example)

Upvotes: 1

ameenulla0007
ameenulla0007

Reputation: 2683

ErrorDocument 404 /404.html

404 here is your error code and /404.html is your redirection file when error occurs. here goes your tutorial.. http://www.totallyphp.co.uk/custom-error-pages-using-htaccess

Upvotes: 0

Related Questions