Created
February 12, 2013 09:40
-
-
Save gigorok/4761219 to your computer and use it in GitHub Desktop.
catch fatal error in php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function catch_fatal_error() | |
{ | |
// Getting Last Error | |
$last_error = error_get_last(); | |
// Check if Last error is of type FATAL | |
if(isset($last_error['type']) && ($last_error['type'] == E_ERROR)) | |
{ | |
// Fatal Error Occurs | |
mail('[email protected]', 'Fatal error', print_r($last_error, 1)); | |
} | |
} | |
register_shutdown_function('catch_fatal_error'); | |
$instance = new Class1(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment