|
Posted by l3vi on 11/20/06 19:00
I have a PHP script that gets started via another PHP script with
exec(). Most of the time it runs, but now and then it dies somewhere in
the process. I have setup the following error handler but I never get a
notice.
Does anyone have an idea what I'm doing wrong?
function errorHandler ($errno, $errstr, $errfile, $errline,
$errcontext)
{
switch ($errno)
{
case E_USER_WARNING:
case E_USER_NOTICE:
case E_WARNING:
case E_NOTICE:
case E_CORE_WARNING:
case E_COMPILE_WARNING:
break;
case E_USER_ERROR:
case E_ERROR:
case E_PARSE:
case E_CORE_ERROR:
case E_COMPILE_ERROR:
$notice .="ERROR NUMBER: $errno\r\n";
$notice .="ERROR: $errstr\r\n";
$notice .="LINE: $errline\r\n";
$notice .="FILE: $errfile\r\n";
mail("my@myhost.com", "Script ERROR : $errfile", "$notice" , "From:
my@myhost.com\nX-Mailer: PHP/".phpversion()."", "-f my@myhost.com");
die();
}
}
$old_error_handler = set_error_handler("errorHandler");
The above function as far as I know will only send me noticed of any
errors that kill the script, when I take out the switch I get a bunch
of noticed about a couple unset vars which I don't care about as they
are vars that are just not set till they are used.
Thanks,
[Back to original message]
|