I'm facing with the Fatal error: Maximum execution time of 30 seconds exceeded.
I'm trying to catch this error and show the error message to user but it seems that "try...catch..." in PHP can't handle this.
I have tried to use "register_shutdown_function" but not success, the script continue to run and display blank page.
$max_execution_time = ini_get("max_execution_time");
ini_set('display_errors', false);
ini_set("max_execution_time", $max_execution_time * 0.8);
register_shutdown_function([$this, 'shutdownHandler']);
...
function shutdownHandler()
{
$error = error_get_last();
if (($error['type'] === E_ERROR) || ($error['type'] === E_USER_ERROR)) {
...
}
}
Would anyone help me in this case?