/ Published in: PHP
Refer here for a full overview: http://net.tutsplus.com/tutorials/php/quick-tip-email-error-logs-to-yourself-with-php/
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php // Our custom error handler function nettuts_error_handler($number, $message, $file, $line, $vars) { $email = " <p>An error ($number) occurred on line <strong>$line</strong> and in the <strong>file: $file.</strong> <p> $message </p>"; $headers = 'Content-type: text/html; charset=iso-8859-1' . " "; // Email the error to someone... // Make sure that you decide how to respond to errors (on the user's side) // Either echo an error message, or kill the entire project. Up to you... // The code below ensures that we only "die" if the error was more than // just a NOTICE. if ( ($number !== E_NOTICE) && ($number < 2048) ) { } } // We should use our custom function to handle errors. // Trigger an error... (var doesn't exist) echo $somevarthatdoesnotexist;
URL: http://net.tutsplus.com/tutorials/php/quick-tip-email-error-logs-to-yourself-with-php/