How to Increase Your PHP Maximum Execution Time

An important aspect to remember about PHP programs is that the maximum time to execute a script is normally set to thirty seconds, although the time limit varies from one hosting company to another. Programs that involve sending mail to many recipients or some heavy export or import of files can cause the user to get errors of the maximum time limit exceeds.

You might need to increase the limit for certain scripts your website uses. For instance, migration plugins in WordPress, depending on how big your website is, usually require a longer run time.

Thirty seconds is the default setting, and you can increase that value. Keep in mind that the value is in seconds, so 2 minutes would be 120, 3 minutes would be 180, and so on. To find the correct value, you can check your plugin, script, or theme’s documentation. You can use the phpinfo() function to verify the current value of the max_execution_time directive and other directives.

If you’re wondering how to set PHP maximum execution time on cPanel, we’re going to do a quick step-by-step guideline for new learners that want to do this. The first thing you need to do once you log in to your cPanel account using your username and password or you can also log in via Verpex Client Area.

The next thing you want to do is find the PHP Selector button. After you’ve selected this button, you will go to the Options section for the php.ini values and scroll down to max_execution_time.


For Unlimited, you set the value to 0. Once you have done the change, make sure that you do a left-click anywhere outside the text input or dropdown box. If you’ve managed to successfully follow the steps we’ve mentioned above, you will be able to see a green box with a message that will confirm that the change you’ve made has been applied.

Measuring Script Execution Time

The time required to execute the PHP script is the script execution time in PHP. Rather than the CPU execution time, use clock time to calculate script execution time. What will help to know script execution time is knowing the clock time after script execution and before script execution.

Use the microtime() function at the beginning and the end of the script. Then using formula (End_time – Start_time). Time returns in seconds with the microtime() function. Execution time depends on the processor, and it is not fixed.

Now you know everything there is to know about increasing the maximum execution time of a script in cPanel. For any further assistance, make sure you contact us so we can help you!