submitted by: Snippissimo

PHP: disable PHP Timeout

By default, php scripts will timeout after 30 seconds. While not recommended, you can override this setting with the set_time_limit() command. Useful if you are using php to process multiple files, etc.


code snippet:
<?php
// Disable PHP Timeout example
// http://php.snippetdb.com

//set php script timeout, 0 to disable
set_time_limit(0);

// your time consuming code

//don't forget to reset to 30 seconds.
set_time_limit(30);

?>

notes:
Important: See official documentation for additional info, for example: set_time_limit() has no effect when PHP is running in safe mode. There is no workaround other than turning off safe mode or changing the time limit in the php.ini.