• By :  Piyush Rishi Singh
  • Last Updated :  December 2, 2022
  • Words Count :  584 Words
  • Est. Reading Time :  4 mins

My latest issue with WordPress has been the limited maximum Media Library Upload Size when I tried uploading a few heavier media files for one of my works.

In this article I’ll show you several methods to increase the Maximum Upload Size for the WordPress Media Library, either by modifying php.ini, functions.php or the .htaccess file. WordPress MU/Multisite/MS use will be addressed as well.

So far I have found these methods to increase the maximum upload size for the WordPress Media Library (in preferred order):

  1. Modifying php.ini
  2. Modifying functions.php
  3. Modifying .htaccess

 

Depending on your web host and the package you’ve chosen, there will be a maximum upload file size set (originally set to around 8mb) which you will be able to view when trying to upload files to your Media Uploader in WordPress.

In most cases (that I’ve experienced) the host will not let you increase this yourself, but it can be increased simply by contacting your host and asking them to increase the limit for you.

media_upload_limit

 

There are 3 limits you want to increase when doing this as these will increase the allowed size of the files that are allowed to be uploaded, an sets the maximum time in seconds a script is allowed to run before it is terminated (max_execution_time).

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

1) Theme Functions File

If the host allows, you could simply increase the file upload size and max execution time by adding the following code into your functions.php file

@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M' );
@ini_set( 'max_execution_time', '300' );

To see if the changes have taken effect go back to your Media upload page and refresh the page.

 

2) Create or Edit an existing PHP.INI file

Generally if you are on a shared host you will not see a php.ini file in your root directory, but if you do then you can search for each of the following lines within the file and then change the values to what you need.

upload_max_filesize
post_max_size
max_execution_time

If you do not see a php.ini file in your root folder then you can (apparently, I haven’t done this before) create one and add the following lines of code to increase your limits.

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

On some servers these changes will take effect immediately while on other servers it can take longer because the server might be caching the files. If the changes do not work after a little while you can also try renaming the file to php5.ini

To see if the changes have taken effect go back to your Media upload page and refresh the page.

 

3) htaccess Method

Again, depending on your host, you can also try increasing the limit by editing your .htaccess file in the root folder on your server.

Open the .htaccess file and add the following code:

php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300

 

Again, I will emphasize that if you are on shared hosting or depending on your host, these methods might not work for you.

In that case we recommend contacting your host to up these limits for you, which could save you a lot of time.

 

Share :
Piyush Rishi Singh

Piyush Rishi Singh

www.piyushrishisingh.com
(Founder & Business Head At Techzax Innovations Pvt. Ltd.)

A Digital Entrepreneur & Content Creator who loves simplifying tech.
Expertise: A Full Stack & highly skilled 10+ years experienced WordPress developer who specializes in complete custom tailored WordPress Websites development.

Table Of Contents