How to increase PHP Max Execution Time

How to increase PHP Max Execution Time

 

Sometimes you might have noticed that certain PHP scripts that you wrote are not working as desired. A very common errror message is Fatal error: Maximum execution time of 30 seconds exceeded.  The cause is the PHP restriction on the directive max_execution_time.
The amount of time a PHP script is allowed to run is defined by the PHP variable max_execution_time. In most shared servers, it will be given a default value of 30 seconds. This post explains how a customer can modify the value of this variable, in case his PHP scripts are supposed to run a little longer. Setting it too high is not recommended.

How to solve Fatal error: Maximum execution time of 30 seconds exceeded

First, login to your cPanel account using your cPanel username and password. If you forgot the password, you can reset it any time using the ‘Reset Password’ option under the login box.

Once logged in and you are in the cPanel dashboard, go to Software -> Select PHP Version option.

 It will take you to a page which lets you choose the version of PHP you would like to run along with the extensions you would like to enable or disable. To the top right of the page, there is another option ‘Switch to PHP Options’. Click on it.


Now, you will see a list of PHP variables along with the values associated to each variable. Check the value of max_execution_time, mostly it will be the default 30. Click on it and you can enter the new value you require. Suppose, I need the value to be raised to 60 seconds, ie. 1 minute. I will enter 60 in the box and hit ‘Apply’. Scroll to the bottom and click on the ‘Save’ button for the changes to get into effect.

  • 349 Users Found This Useful
Was this answer helpful?