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

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 desired value in seconds and wait for the value to automatically be saved.
Discuss the article:

Comment anonymously. Login not required.

Share!