How to set maximum execution time

    October 3, 2019

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

    Definition

    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_time_limit(600);

    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.

    Was this article helpful?

    Send feedback

    Can’t find what you’re looking for?

    Our award-winning customer care team is here for you.

    Contact Support