Increase the PHP execution time

 

Overview

The following describes how to view or adjust the PHP execution time from your control panel or by editing a phprc file.

Background

Every installation of PHP comes with default settings, which are usually fine for most websites. Occasionally, the needs of a website make it necessary to adjust these PHP settings. For example, your site may require scripts to run longer than the current PHP execution time allows. Depending on your hosting plan, you may be able to adjust this setting from the control panel or manually using a php.ini (phprc) file.

The DreamHost phprc file

The standard term for a PHP configuration file is php.ini. However, DreamHost uses the term phprc file instead. This acts the same way — only the name is different. In this article, only the term phprc is used.

Difference between max_execution_time and max_input_time

  • max_execution_time — sets the maximum time in seconds a script is allowed to run before it is terminated.
  • max_input_time — sets the maximum time in seconds a script is allowed to parse input data, such as POST and GET. This is usually increased to allow for larger file uploads. By default, max_input_time is set to -1, which means that max_execution_time is used instead.

Adjusting the execution time from the panel

To adjust the PHP execution time from the panel:

Please note the following:

max_execution_time default value varies by hosting plan.

If you need to set a custom value, you can do so manually using a php.ini (phprc) file.

  1. Navigate to the Manage Websites page.
  2. Click the Manage button to open Website settings, which allows you to modify various configurations for your site.
    • If in Grid view, click the Manage button at the bottom of the website box.
    • If in List view, click the Manage button at the far right of your domain name.
  3. Click the Settings tab.
  4. In the Website Settings section, click Manage next to PHP.

    The PHP Settings page opens.
  5. Scroll down to the PHP Settings section.
  6. Next to General, click the Modify button.
  7. Enter the desired value for max_execution_time (120 to 300 seconds).
  8. Click Save Changes.

    No manual restart or process killing is required when using the panel.

Setting a custom execution time with a phprc file

The following shows you how to create a phprc file and then make adjustments to it:

 

Create a phprc file

View the following articles for instructions on how to create a phprc file:

If the file already exists, view the following articles for instructions on how to update it (depending on if you're using an FTP client or SSH):

Update the file

Add the following line to set this limit to 500 seconds:

max_execution_time = 500

Kill off all running php processes

Make sure to kill running php processes to ensure your new settings take effect.

Confirm your changes

After you've edited the file and killed off all PHP processes, you should check to confirm the values have updated. You can do this by creating a phpinfo.php file.

If you do not see your changes have updated, try killing off your PHP processes again.

See also

Did this article answer your questions?

Still not finding what you're looking for?