Increase the PHP execution time

 

Overview

The following describes how to use a phprc file to increase the PHP execution time.

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 need to upload files larger than the current PHP upload limit allows. In that case, you would need to create a php.ini (phprc) file and update this value.

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. The default is 30 seconds.
  • 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. The default setting is -1, which means that max_execution_time is used instead. Set it to 0 to allow an unlimited time.

Increasing the execution time

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 increase 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?

Article last updated PST.

Still not finding what you're looking for?