Every once in a while I need to process a HUGE file. Though PHP probably isn’t the most efficient way of processing the file, I’ll usually use PHP because it makes coding the processing script much faster. To prevent the script from timing out, I need to increase the execution time of the specific processing script. Here’s how I do it.
The best way I find is to do it via .htaccess – Using the max_execution_time directive
By default, the maximum execution time for PHP scripts is set to 30 seconds (or you can open a support ticket and we will update it for you). If a script runs for longer than 30 seconds, PHP stops the script and reports an error. You can control the amount of time PHP allows scripts to run by changing the max_execution_time directive in an .htaccess file.
To change the maximum execution time for your PHP scripts, follow these steps:
– Log in to your account using FTP.
– Use a text editor to add the following line to the .htaccess file. Replace 30 with the maximum execution time value that you want to set, in seconds:
php_value max_execution_time 30
– Save the changes to the .htaccess file and exit the text editor.
-To verify that the new setting is active, create a PHP test file that contains the following code in the same directory where the .htaccess file is located:
<?php phpinfo(); ?>
Load the test file in your web browser, and then search for the name of the directive. The Local Value column should display the new setting that you specified in the .htaccess file.
TD Web Services was founded with a simple philosophy in mind: provide the best quality service and support to customers at a low price. Since then, we have refined our mission to provide exceptional service, not just servers.