If your PHP scripts run longer than the maximum execution time set by your webhoster, then you will see a message like this:
Fatal error: Maximum execution time of 30 seconds exceeded in ...
To override the default for your webspace, you can use the php_value directive in a .htaccess file.
To set the value to “0”, which means no limit, add this line:
php_value max_execution_time 0
I suggest to either set it to unlimited, run the long running script and then comment it out or set it to some reasonable value like 120 or 300, depending on the time the script usually needs.