This question already has an answer here:
When you register a function in register_shutdown_function
how can you check for the error max execution time limit?
register_shutdown_function(function(){
if(something)){
// max execution time exceeded
}
});
</div>