KNOWNHOST KNOWLEDGE BASE

Hosting Question? Find the Solution - Browse our Guides, Articles, and How-To's

How To Change WordPress Upload Limit

Category: WordPress
Tags: # # #

If you’d like to change the maximum upload file size limit for WordPress, check out the below step-by-step guide that reveals how to check the current limit, what three configuration settings can limit max uploads, and what you can do to increase the WordPress upload limit.

Note: Some hosting companies restrict memory, file upload size, and other configuration options so that server resources don’t get exhausted.

How to Check WordPress Max Upload Settings

Within the WordPress admin area, after logging in, you’ll be able to see what WordPress has limits set for uploads maximum. Strangely, WordPress is unaware of two other lower-level system settings that can influence this, but at least you’ll have one system setting known and in hand.

  1. Login to the WordPress admin area
  2. Click on Media → Add New
  3. Look at the bottom where it says: Maximum upload file size: MB.

The 3 Key System Settings that Limit Max Upload Size

The max upload size for WordPress can be constricted by any or all of three different system configuration settings. By putting any one of these at a lower value, you’ll be unable to upload larger files within WordPress.

Remember that the lowest setting is the one that determines the max upload size limit. Larger settings in any one or two of the three will not suddenly allow larger uploads to occur.

When trying to increase the values, raise the max value in any one of them (if the other two don’t specify a value). However, the safest option is to check all three to see what values are present and find the most restrictive, then change it to a larger value. Making changes across all three is the sure fire way of getting a change to take hold

PHP.INI

The php.ini file determines the limits at the lowest level of the system.

There can be times when php.ini is configured more restrictively than WordPress and users attempting to upload large files will be met with a PHP related error like, “…exceeds the upload_max_filesize directive…”.

When you want to up the max file size allowed to be uploaded at the PHP level, there are actually three different settings that need to be manipulated. We’ll cover the steps to make these changes a bit later.

The three settings in php.ini which influence the maximum file size you can upload include:

  upload_max_filesize
  post_max_size
  memory_limit

These are listed in a particular order, for good reason! memory_limit needs to be set larger than post_max_size, which needs to be set larger than upload_max_filesize. If you want to be able to upload 50MB files, then upload_max_filesize needs to be set at or above 50MB, post_max_size a few MB larger than this (like 55MB) and memory limit larger than that (like 60MB).

Memory limit can be set to values much larger than this – it’s being set just high enough to allow for large uploads and large posts, but shouldn’t automatically be set to just slightly above this limit. If you have a lot of script processing going on, it could be much better to set it higher, like 128M or 256M.

The php.ini file will need to have three lines, if you wish to make changes to max upload via PHP configuration. Lines would look like:

  • upload_max_filesize = 50M
  • post_max_size = 55M
  • memory_limit = 60M

.HTACCESS

Running on top of the PHP interpreter, the web server (Apache) can rely on .htaccess for configuration settings that determine how it will perform certain tasks.

In the root folder of the Apache web server, there is often a file named .htaccess. If there aren’t already a couple of lines like below contained within, which could be edited, those lines will need to be added:

  • php_value upload_max_filesize 50M
  • php_value post_max_size 55M
  • php_value memory_limit 60M

Note: The above follows the upper example of a desired max file size upload of 50MB.

WP-CONFIG.PHP

The final configuration file that can impact your max upload size is the wp-config.php file. Again, this can restrict, but can’t override settings in .htaccess or php.ini (it can make smaller but not larger).

Settings would be implemented as:

  • @ini_set( ‘upload_max_size’ , ’50M’ );
  • @ini_set( ‘post_max_size’, ’55M’);
  • @ini_set( ‘memory_limit’, ’60M’ );

How to Change WordPress Upload Limit

The most popular, and arguably the easiest, way to change the upload max file size limit for WordPress, can mean changing multiple settings across all three areas.

With this approach, you can make changes to php.ini using cPanel, and then move on to the .htaccess and wp-config.php settings.

Before proceeding, as always with any major system changes, it’s prudent to make a backup. Technically, you could just back up the three files you’re about to change, but if you haven’t made a recent backup anyway, or you’re making several other changes, why not make a more robust backup right now, before proceeding?

Changing php.ini using cPanel

  1. Login to cPanel
  2. Click Software → Select PHP Version
  3. Switch to PHP Options
  4. One by one, select each of the three settings and make changes by setting the value in the dropdown to the new values before clicking apply.
  5. Click Save at the bottom

Reminder: The settings in the example above included…

  upload_max_filesize = 50M
  post_max_size = 55M
  memory_limit = 60M

Changing .htaccess using cPanel File Manager

  1. Login to cPanel
  2. Click Files → File Manager
  3. Click Document Root for → Select the domain to change
  4. If Show Hidden Files isn’t ticked, then select it so that it is
  5. Click Go
  6. Find .htaccess in file list, right click and pick Code Edit
  7. If a character set/encoding message appears, just click Edit to continue
  8. Look for the items to change – if present, edit – otherwise add the items
  9. Click Save Changes
  10. Close

Reminder: The settings in the example above included…

  php_value upload_max_filesize 50M
  php_value post_max_size 55M
  php_value memory_limit 60M

Changing wp-config.php using cPanel File Manager

  1. Follow steps 1 to 5 as above, but navigate to the WordPress install folder where wp-config.php is located
  2. Find wp-config.php in the file list, right click and pick Code Edit
  3. If a character set/encoding message appears, just click Edit to continue
  4. Look for the items to change – if present, edit – otherwise add the items
  5. Click Save Changes
  6. Close

Reminder: The settings in the example above included…

  @ini_set( 'upload_max_size' , '50M' );
  @ini_set( 'post_max_size', '55M');
  @ini_set( 'memory_limit', '60M' );

Conclusion

Increasing the max upload size in WordPress can allow you to make posts that contain larger files and enable you to include media stored locally rather than embedded from external sources.

Have a WordPress website? Check out our Managed WordPress Hosting and see if we are a good fit for you. KnownHost offers 365 days a year, 24 hours a day, all 7 days of the week best in class technical support. A dedicated team ready to help you should you need our assistance. You’re not using KnownHost for the best webhosting experience? Well, why not?