Increase the PHP execution time

Overview

Every installation of PHP comes with default settings which are usually fine for most websites. Occasionally, the needs of a website makes 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.

Some variables (in particular, memory_limit, post_max_size and upload_max_filesize) are subject to internal limitations; increasing them significantly beyond the default values will not work correctly and will cause issues with your site.

Difference between max_execution_time and max_input_time

max_execution_time and max_input_time control the following:

  • max_execution_time — This sets the maximum time in seconds a script is allowed to run before it is terminated. The default is 30 seconds.
  • max_input_time — This sets the maximum time in seconds a script is allowed to parse input data, like 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 to 0 to allow unlimited time.

Increasing the execution time

The default execution time is 30 seconds, which may be too small for your needs. If you need to raise this limit, you must 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):

To increase this limit to 500 seconds, add the following:

max_execution_time = 500

Kill off all running php processes

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

Confirming 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.