Skip Navigation

php.ini Guide: Resource Limits

« Back to php.ini Guide Introduction

The resource limits section of the php.ini file controls how much of the available resources on a server PHP is allowed to use. It is important that you make sure these are set appropriately.

max_execution_time = 30

After a certain amount of time, all scripts running on a server are brought to an end. This prevents scripts containing infinite loops from causing too much trouble on a server. This setting sets how long a single script can run for before it is stopped. I rarely increase this, unless a script is going to need more time to preform a specific task, like fetch a very large remote file. Often, I will decrease this to as low as 5 or 10 seconds, on sites running scripts that should never take longer than a fraction of a second to run.

Values: Time in seconds (integer). Default: 30.

max_input_time = 60

The maximum input time is independant of max_execution_time, and defines, in seconds, the amount of time a script may spend processing incoming request data, like querystrings, forms and cookies. If your site can accept file uploads, this setting will affect you. Otherwise, leave this alone. If you wish, you can reduce this to 20 or 30 seconds, or perhaps less, but there is little advantage to doing so.

If you are accepting large file uploads - many many megabytes - then you may need to increase this. However, I would recommend doing so only for the specific scripts that may need more time to receive files, using the ini_set() function (ini_set will not have an effect if safe_mode is on).

Values: Time in seconds (integer). Default: 60.

memory_limit = 8M

This setting controls the amount of memory a single script is allowed to allocate. You may want to increase this to 16M or 32M, however well-written PHP will usually not need this to be increased. This setting is most useful to prevent a single script from using all resources, thereby slowing down a site.

Values: Memory in bytes (integer). Default: 8M (8 megabytes). A setting of -1 removes the limit.

« Back to php.ini Guide Introduction

One comment

I am creating a file transfer site for files that are up to 100mb, part of this is an html upload then an ftp transfer, are there any other php ini settings that will cause this to be a problem?

Post Your Comment

· Comments with keywords instead of a name have their URLs removed.
· Your email address will not be displayed or shared.

Live Comment Preview

 United States #2: 1 minute ago