PHP scripts by default are allowed to be executed for no longer than 30 seconds. The option is defined in the max_execution_time directive, and your PHP script will exit with the following error if it takes more time to execute than it is allowed;

Fatal error: Maximum execution time of 30 seconds exceeded in yourscript.php

There are a few methods that you can use to configure PHP time limit though some are not possible with cPanel because you don't have direct access to PHP's configuration file.

You can increase max_execution_time for PHP even when you're in cPanel hosting by using both ini_set() and set_time_limit() functions. It's also possible to use the .htaccess file method within cPanel.

You don't have direct access to php.ini configuration file in cPanel, but you can configure the option from cPanel's dashboard.

Step-by-step video guide:

Steps to change PHP max_execution_time in cPanel:

  1. Log in to your cPanel dashboard.
  2. Go to the Software section and click on Select PHP Version.
  3. Click on Options tab.
  4. Scroll down and look for max_execution_time and click on the value field.
  5. Enter the desired value in seconds and wait for the value to be saved automatically.
Discuss the article:

Comment anonymously. Login not required.

Share!