"; $subject = "Custom Error Handling"; $body = ""; $body .= ""; $body .= ""; $body .= ""; $body .= ""; $body .= "

Fatal Error

"; $body .= "Error received was a " . $error_type . " error.
"; $body .= "The page that generated the error was: " . $error_file . ""; $body .= " and was generated on line: " . $error_line . "
"; $body .= "The generated error message was:" . $error_message; $body .= ""; $body .= ""; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: Apache Error \r\n"; $headers .= "Cc: webmaster@yourdomain.com\r\n"; mail($to, $subject, $message, $headers); die(); //kill the script break; //warnings case E_WARNING: $to = "Administrator "; $subject = "Custom Error Handling"; $body = ""; $body .= ""; $body .= ""; $body .= ""; $body .= ""; $body .= "

Warning

"; $body .= "Error received was a " . $error_type . " error.
"; $body .= "The page that generated the error was: " . $error_file . ""; $body .= " and was generated on line: " . $error_line . "
"; $body .= "The generated error message was:" . $error_message; $body .= ""; $body .= ""; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: Apache Error \r\n"; $headers .= "Cc: webmaster@yourdomain.com\r\n"; mail($to, $subject, $message, $headers); break; //script will continue //notices case E_NOTICE: //don't show notice errors break; } } /* set error handling to 0 we will handle all error reporting only notifying admin on warnings and fatal errors don't bother with notices as they are trivial errors really only meant for debugging */ error_reporting(0); //set the error handler to be used set_error_handler("handler"); /* Create the rest of your page here. We will not be displaying any errors We will be e-mailing the admin an error message Keep in mind that fatal errors will still halt the execution, but they will still notify the admin */ ?>