RE: [PHP] PHP/Mysql error handling

From: Date: Mon, 05 Nov 2001 08:28:13 +0000
Subject: RE: [PHP] PHP/Mysql error handling
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-73454@lists.php.net to get a copy of this message
Write this function in your main library file. This Logs errors ( you could modify it to log warnings too ) in a file. Sample code $debug=1; if ($debug) { set_error_handler('error_handler');} // error_reporting (E_ALL); function error_handler ($type, $message, $file=__FILE__, $line=__LINE__) { //006699 $file=str_replace("/var/www/html/test/","<font color='#006699'>",$file); $file=str_replace("php","php</font>",$file); $message="<font color='#990000'><b>".$message."</b></font>"; if ($type & E_ERROR) { error_log("$message, $file, $line <br>", 3, 'myerrors.html'); //print 'An error occurred, it has been logged // and it will be addressed.'; //exit; } else { error_log(date("Y-m-d H:i:s ")."$message, $file, $line <br>", 3, 'mywarnings.html');} } > -----Original Message----- > From: George E. Papadakis [mailto:georgep@phaistosnetworks.gr] > Sent: Sunday, November 04, 2001 12:47 PM > To: PHP List > Subject: [PHP] PHP/Mysql error handling > > > Hi, > > Is there any way to make php notify me of any errors through > email? I know it may sounds funny, but imagine having this > huge site and u just want it to run smoothly but u juct cant > check it all the time . If there was a way that php would > notify u for a an error on a specific page/line that would > make debuggin much easier and without guessing.. So, is it possible? > > Thanks. > > -- phaistonian > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: > php-general-help@lists.php.net To contact the list > administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#73454) next »