We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.
Contact Us
Contact Us
Sign in
Sign in
Nexcess Logo

How to set maximum execution time

September 10, 2019

Learn what this settings does and how to change its value within PHP scripts.


Maximum execution time refers to the default maximum amount of time a PHP script will run before PHP terminates the script and reports an error.

How to change maximum execution time

You may use one of three possible methods to alter your maximum execution time.

Modify the php.ini file

We do not permit our clients with managed hosting plans to modify their php.ini files, but our support team may implement changes on your behalf. 

Set maximum execution time for individual PHP scripts

You may adjust maximum execution time via PHP’s set_time_limit function. This value replaces the max_execution_time variable within the php.ini file.

For example, to change the execution time limit for a particular PHP script to ten minutes, convert the time limit to seconds add the following line at the beginning of the script:


Set maximum execution time for PHP scripts from the CLI

You may set the maximum execution time manually from the command line by using the -d flag with the PHP command as follows:

php -d max_execution_time=300 script.php

The above command would run script.php with a maximum execution time of 300 seconds regardless of the globally set max_execution_time value. If you need this change made globally, contact our support team for assistance.

For 24-hour assistance any day of the year, contact our support team by email or through your Client Portal.
Jason Dobry