Try it. If I encounter any error in any file, I received an error message on my email id. Create two index.php and checkErrorEmail.php and upload them to your server. Then download index.php to your browser.
Index.php
<?php include('checkErrorEmail.php'); include('dereporting.php'); $temp; echo 'hi '.$temp; ?>
checkErrorEmail.php
<?php // Destinations define("ADMIN_EMAIL", "pradeep.callus7@hotmail.com"); //define("LOG_FILE", "/my/home/errors.log"); // Destination types define("DEST_EMAIL", "1"); //define("DEST_LOGFILE", "3"); /* Examples */ // Send an e-mail to the administrator //error_log("Fix me!", DEST_EMAIL, ADMIN_EMAIL); // Write the error to our log file //error_log("Error", DEST_LOGFILE, LOG_FILE); /** * my_error_handler($errno, $errstr, $errfile, $errline) * * Author(s): thanosb, ddonahue * Date: May 11, 2008 * * custom error handler * * Parameters: * $errno: Error level * $errstr: Error message * $errfile: File in which the error was raised * $errline: Line at which the error occurred */ function my_error_handler($errno, $errstr, $errfile, $errline) { echo "<br><br><br><br>errno ".$errno.",<br>errstr ".$errstr.",<br>errfile ".$errfile.",<br>errline ".$errline; if($errno) { error_log("Error: $errstr \n error on line $errline in file $errfile \n", DEST_EMAIL, ADMIN_EMAIL); } /*switch ($errno) { case E_USER_ERROR: // Send an e-mail to the administrator error_log("Error: $errstr \n Fatal error on line $errline in file $errfile \n", DEST_EMAIL, ADMIN_EMAIL); // Write the error to our log file //error_log("Error: $errstr \n Fatal error on line $errline in file $errfile \n", DEST_LOGFILE, LOG_FILE); break; case E_USER_WARNING: // Write the error to our log file //error_log("Warning: $errstr \n in $errfile on line $errline \n", DEST_LOGFILE, LOG_FILE); break; case E_USER_NOTICE: // Write the error to our log file // error_log("Notice: $errstr \n in $errfile on line $errline \n", DEST_LOGFILE, LOG_FILE); break; default: // Write the error to our log file //error_log("Unknown error [#$errno]: $errstr \n in $errfile on line $errline \n", DEST_LOGFILE, LOG_FILE); break; }*/ // Don't execute PHP internal error handler return TRUE; } // Use set_error_handler() to tell PHP to use our method $old_error_handler = set_error_handler("my_error_handler"); ?>
Pradeep Jul 17 '13 at 10:10 2013-07-17 10:10
source share