Our Help Portal

Troubleshooting Support Articles
Searchable Help Information Repository
Self-Service Resources How-Tos
Technical Customer Walkthroughs   Browse All Knowledge ! ....

Get Prices Learn More

Breaking

< All Topics
Print

Setup the PHP maximum execution time in an .htaccess file

In an .htaccess file, you can set the PHP maximum execution time using the php_value directive. Here’s how you can do it:

  • Create or Edit .htaccess File:
    • Using a text editor, create a new file named .htaccess if you don’t have one in your website’s root directory. If you already have one, you can edit it.
  • Add Execution Time Configuration:
    • Add the following line to your .htaccess file to set the PHP maximum execution time. Adjust the value of max_execution_time to your desired execution time in seconds.

apache
<IfModule mod_php5.c>
php_value max_execution_time 120
</IfModule>

If you’re using PHP as a FastCGI application, you can use the following:

apache
<IfModule mod_fcgid.c>
FcgidWrapper “php-cgi .php” .php
php_value max_execution_time 120
</IfModule>

    • In the above examples, 120 represents the maximum execution time in seconds. You can adjust this value based on your requirements.
  • Save and Upload:
    • Save the changes to the .htaccess file and upload it to your website’s root directory using FTP or your hosting file manager.
  • Verify the Changes:
    • To confirm that the maximum execution time has been set, you can create a PHP file (e.g., phpinfo.php) in your web directory with the following content:

php
<?php
phpinfo();
?>

  • Open this file in your browser and search for “max_execution_time” to see if the new limit is reflected.

Please note that modifying PHP settings via .htaccess may not be allowed on all hosting environments, and some hosting providers may have restrictions in place. If you encounter issues or if your changes don’t take effect, you may need to contact your hosting support for assistance or use alternative methods to modify PHP configuration, depending on your hosting environment.

Categories