Increasing the WordPress File Size Upload Limit

I do a lot of work on WordPress sites and one of the common issues I see is with administrators trying to increase the file size upload limits.  They either have difficulty finding the correct place to increase this limit or forget to increase things like script execution to allow for file processing times.

In this post I hope to address all these issues and explain what these commands actually do.

The important settings.

There are actually 5 settings related to file upload limits and execution times in PHP.

  1. memory_limit
    This is the total memory allocated to a single PHP script. This figure needs to be at least equal too or greater than “post_max_size”.
  2. post_max_size
    This defines the maximum size of a post request.  The post will contain the upload file or files and any additional information you included, so this should be set to a value larger than the “upload_max_filesize”.
  3. upload_max_filesize
    This defines the maximum file size that can be uploaded.
  4. max_input_time
    This defines the maximum time, in seconds, a script is allowed to receive input.  This includes file uploads from post and get.
  5. max_execution_time
    Defines the amount of time, in seconds, a script is allowed to run after receiving data from post/get.  This includes any processing of the file once uploaded.

Where to configure these settings.

There are a number of locations where you can configure these settings.  Which files files you need to edit will depend on your host setup and if you are on a shared server you may need to contact your hosting provider.

Please note that the values used below are examples and you will need to modify them to suit your requirements.


This is the primary configuration file for php and the location will differ depending on your configuration.

You can find the file by creating a phpinfo.php file with the following content in your websites root directory:

<?php phpinfo(); ?>

Look for the section “Loaded Configuration File”.

Once you have located the file edit or add the following lines:

memory_limit = 110M
post_max_size = 100M
upload_max_filesize = 90M
max_input_time = 300
max_execution_time = 300


You can also set these values in the .htaccess file in your websites root directory, if this file doesn’t exist you can create it.

Add the following lines to the file:

php_value memory_limit 110M
php_value post_max_size 100M
php_value upload_max_filesize 90M
php_value max_input_time 300
php_value max_execution_time 300

WordPress functions.php

Within your WordPress theme there should be a functions.php file.  Add or edit the following lines in that file.

@ini_set( 'memory_limit', '110M' );
@ini_set( ‘post_max_size’, ‘100M’);
@ini_set( ‘upload_max_size’ , ‘90M’ );
@ini_set( `max_input_time`,`300`);
@ini_set( ‘max_execution_time’, ‘300’ );

Other things to check

In addition to the settings above there are some other settings that may or may not have been set depending on your setup.  If you above doesn’t work you can check the following items.

WordPress Memory Limit

WordPress has an internal memory limit setting which restricts the amount of PHP memory it can use.  This is done by editing the wp-config.php file and modifying the follwoing line:

define('WP_MEMORY_LIMIT', '96M');

Apache LimitRequestBody

Another setting that can be used to restrict file upload sizes is Apaches LimitRequestBody setting.  This is located in your Apache configuration file or the .htaccess file.  It will look something lime the following:

<Directory "/var/www/blogs/wp-uploads">
 LimitRequestBody 102400

If this is not set then Apache is not limiting upload sizes.  If you are on a shared host this is something your provider might set.

I think that about covers everything, comments are welcome as even though I have proof read this I wouldn’t be surprised if I missed something.

One Reply to “Increasing the WordPress File Size Upload Limit”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s