How to Increase Server PHP Timeout Limit in cPanel: A Step-by-Step Guide

​​If you manage a website hosted on a server using cPanel, you might need to increase the PHP timeout limit for various reasons. This timeout limit determines how long a script will run before being terminated by the server. For websites that perform heavy tasks, such as uploading large files or executing complex queries, increasing the timeout limit can be essential to avoid errors like the “Maximum execution time exceeded” message.

Step-by-Step Guide To Increase Server PHP Timeout Limit

In this guide, we’ll walk you through the process of increasing the PHP timeout limit in cPanel.

Step 1: Log in to Your cPanel Account

To begin, you need to log in to your cPanel account.

  1. Open your web browser and go to the cPanel login page (usually yourdomain.com/cpanel). 
  2. Enter your username and password, then click Log in. 

Step 2: Locate the “Select PHP Version” Option

After logging into your cPanel, follow these steps:

  1. Scroll down to the Software section. 
  2. Look for an option called Select PHP Version. Click on it. 

Note: If you do not see this option, your hosting provider may have restricted access to PHP settings. In that case, you might need to contact them for assistance.

Step 3: Access PHP Options

Once you are in the Select PHP Version section:

  1. On the next page, click on the Options tab, which will display various PHP settings for your site. 
See also  How To Build A Micro-Segmentation Strategy

Step 4: Find the max_execution_time Setting

In the Options tab, you will see a list of PHP settings. Look for the max_execution_time option. This controls the maximum amount of time (in seconds) a PHP script is allowed to run before it is terminated by the server.

Step 5: Increase the Timeout Limit

To increase the PHP timeout limit:

  1. Next to max_execution_time, click on the current value (it will likely be set to something like 30 or 60). 
  2. Enter a new higher value, such as 300 (5 minutes), depending on how long you want your scripts to run. 
  3. Press Save to apply the changes. 

Step 6: Verify the Changes

To ensure the changes have taken effect, you can create a phpinfo() file to check the current PHP settings.

1. Use a text editor to create a new file named phpinfo.php. 

Add the following code to the file:

<?php

phpinfo();

?>


2. Upload the file to your website’s root directory (typically public_html). 

3. Access the file in your browser by navigating to yourdomain.com/phpinfo.php. 

4. Look for the max_execution_time value in the output to verify that the new limit is active. 

Alternative Method: Using the .htaccess File

If you do not have access to the Select PHP Version option or want to modify the settings directly via code, you can increase the PHP timeout limit by editing your .htaccess file.

  1. Open File Manager in cPanel (under the Files section). 
  2. Navigate to the root directory of your website (usually public_html). 
  3. Locate the .htaccess file. If you cannot see it, ensure that hidden files are visible by selecting the option in the File Manager settings. 
  4. Right-click on the .htaccess file and click Edit.
  5. Add the following lines to the file:

See also  6 Tips To Get The Most Out Of Your Digital Marketing Agency

php_value max_execution_time 300

php_value max_input_time 300

      6. Save the changes and close the editor. 

These changes will apply a 5-minute execution time limit for all PHP scripts running on your server.

Alternative Method: Using the php.ini File

Some servers allow you to modify the PHP configuration using a php.ini file.

1. Open File Manager in cPanel and navigate to your website’s root directory. 

2. Look for the php.ini file. If it does not exist, you can create one. 

Add or modify the following lines in the php.ini file:

max_execution_time = 300

max_input_time = 300


3. Save the file. 

Note: Some hosting environments may not allow users to modify the php.ini file. In such cases, this method may not work, and you may need to use the .htaccess or Select PHP Version method instead.

Step 7: Test Your Changes

Once you’ve made the changes, test your website or scripts again to ensure that the new timeout settings are working correctly. If you continue to face issues with script execution timeouts, you might want to increase the timeout further or contact your hosting provider for assistance.

Conclusion

Increasing the PHP timeout limit in cPanel is a straightforward process that can prevent timeout errors on your website. Whether you use the Select PHP Version option, modify the .htaccess file, or edit the php.ini file, these changes should help your PHP scripts run without interruption. Always test your changes after applying them to ensure that the timeout is properly extended.

If you’re unsure or the changes do not take effect, don’t hesitate to reach out to your hosting provider for further support.

Digital Web Services

Digital Web Services (DWS) is a leading IT company specializing in Software Development, Web Application Development, Website Designing, and Digital Marketing. Here are providing all kinds of services and solutions for the digital transformation of any business and website.

We will be happy to hear your thoughts

      Leave a reply

      Digital Web Services
      Logo