I have one script that sometimes gives Max execution times reached error. This is normal, not this a problem. The problem is that in this case I would write specific error message.
How do i do this?
Maximum execution time (max_execution_time) is a time limit on how long a PHP script can run. It is a way hosting providers can limit the use and abuse of server resources, especially for shared hosting. The actual default value depends on the hosting, but it-s usually set to 30 (i.e. 30 seconds).
Using PHP max_execution_time directive You can control the amount of time PHP allows scripts to run by changing the max_execution_time directive in your php. ini file. To verify the current value of the max_execution_time directive and other directives, you can use the phpinfo() function.
function say_goodbye() {
if (connection_aborted()) {
// Perform some action if user has aborted the transaction
} elseif (connection_status() == CONNECTION_TIMEOUT) {
// perform some other action if the connection has timed out
} else {
// any normal completion actions
}
}
register_shutdown_function("say_goodbye")
You can also pass parameters to the shutdown function
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With