Search Our Database

How to Change the PHP “max execution time” with “.htaccess” File

Last updated on |
by

Introduction

Adjusting the PHP “max execution time” is essential for ensuring your website’s scripts run without timing out. One simple method to change this setting is by modifying the .htaccess file in your website’s public_html directory. This guide will walk you through the steps needed to increase the max execution time for PHP scripts.

 

Step 1: Access the .htaccess File

To increase the max execution time in PHP, you need to upload a “.htaccess” file into the “public_html” folder of your website, if the .htaccess has already existed in the public_html folder, simply just edit the file and add the line as in the next step.

 

Step 2: Add the Max Execution Time Setting

Add the line below in the .htaccess file:-

php_value max_execution_time <value-that-you-want-to-set>

example:-

php_value max_execution_time 60

Save the changes to the .htaccess file and upload it back to the public_html directory if you are using an FTP client.

 

Conclusion

By following these steps, you can easily modify the PHP “max execution time” for your website, ensuring that your scripts have sufficient time to execute without interruptions. This adjustment can help prevent issues related to script timeouts and improve the performance of your website.