PHP - registar erros fatais

PHP - registar erros fatais e outros em ficheiro, usando register_shutdown_function

register_shutdown_function( "fatal_handler" );


function fatal_handler() {

$errfile = "unknown file";
$errstr = "shutdown";
$errno = E_CORE_ERROR;
$errline = 0;
$error = error_get_last();

if( $error !== NULL) {

$errno = $error["type"];
$errfile = $error["file"];
$errline = $error["line"];
$errstr = $error["message"];

}

}

fonte:
http://stackoverflow.com/questions/277224/how-do-i-catch-a-php-fatal-error


2013-04-17