Me7888
Me7888

Reputation: 1209

PHP : Send Email Notification to my email id If 500 internal error found in any page

How can we know 500 internal error occurred in any PHP Script..So i want to received mail notification on my email ID Like

500 error found on /home/user/data/xyz.php at 03/05/2014 : 10.20 PM 

Note: I am use WHM/cPanel

Upvotes: 1

Views: 1422

Answers (1)

bumperbox
bumperbox

Reputation: 10214

With apache you can create a .htaccess file, put a command like this in the htaccess file

ErrorDocument 500 /path/to/your/email/script.php

Every time a 500 error occurs apache will redirect to that file.

Here is a full explanation

http://www.totallyphp.co.uk/custom-error-pages-using-htaccess

and these are the official apache docs

http://httpd.apache.org/docs/current/mod/core.html#errordocument

Upvotes: 1

Related Questions