How to set maximum execution time

How to set maximum execution time

This article defines maximum execution time and explains 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 the Nexcess Support Team may implement changes on your behalf. Contact our Support Team for assistance.

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 the Nexcess Support Team for assistance.


For 24-hour assistance any day of the year, contact our Support Team by email or through the Client Portal.

Article Rating (1 Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
How to install Invision Power Board
Added on Fri, Feb 15, 2019
What is a temporary or dynamic IP address?
Added on Mon, Jan 26, 2015
How to transfer files using WinSCP
Added on Fri, Aug 15, 2014
Installing Phorum
Added on Tue, Aug 6, 2013
Installing MyBB
Added on Mon, Aug 5, 2013
How Nexcess limits bad bots
Added on Mon, Apr 15, 2019