you can use set_error_handler to catch PHP errors and use Zend_Log to register them at your discretion.
The only problem with this function is not to catch all the PHP errors, it is impossible to catch errors such as syntax errors ....
Another method is to play with register_shutdown_function
like this:
error_reporting(E_ALL); ini_set('display_errors', 0); function shutdown(){ $isError = false; if ($error = error_get_last()){ switch($error['type']){ case E_ERROR: case E_CORE_ERROR: case E_COMPILE_ERROR: case E_USER_ERROR: $isError = true; break; } } if ($isError){ echo "Script execution halted ({$error['message']})"; } else { echo "Script completed"; } } register_shutdown_function('shutdown');
It is worth noting that even combining both methods, it will not catch all errors, such as syntax errors .... But you could see such an error using a normal browser.
source share