How to increase Max Upload Size Limit in WordPress

While working on WordPress, you might have come across several warning or errors like this:-

  • Warning post content-length of bytes exceeds the limit…
  • The uploaded file exceeds the upload_max_filesize directive in php.ini…
  • exceeds the maximum upload size for this site…
  • Fatal error: Allowed memory size of 12345678 bytes exhausted (tried to allocate 2345678 bytes) in /home/your-username/public_html/wp-includes/plugin.php on line 1000…
  • 413 Error: Request Entity Too Large

This happens when PHP Upload Max Filesize (upload_max_filesize) set in your php.ini file is smaller than the file you are trying to upload.

To solve this issue, here are the following solutions:-

1 –  By Editing php.ini File

php.ini file is the default Php configuration file in a server, you can edit it by logging into your FTP account or Cpanel
Btw before editing anything, taking backup of the file is always a good idea.

– locate following code in php.ini file

memory_limit
upload_max_size
post_max_size
upload_max_filesize
max_execution_time
max_input_time

and add following values to it

memory_limit = 256M
upload_max_size = 64M
post_max_size = 64M
upload_max_filesize = 64M
max_execution_time = 300
max_input_time = 1000

2- Using .htaccess file
.htaccess is a configuration file for use on web servers running the Apache Web Server software. When a .htaccess file is placed in a directory which is in turn ‘loaded via the Apache Web Server’, then the .htaccess file is detected and executed by the Apache Web Server software. These .htaccess files can be used to alter the configuration of the Apache Web Server software to enable/disable additional functionality and features that the Apache Web Server software has to offer. This file can be found in the root directory of your server.

Again before editing anything, please take the backup of this file : –

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

3- By Editing theme’s functions.php file.
In some case adding few lines in theme’s functions.php file may solve the problem

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

 

4 – Change PHP Options in cPanel
If your host provides you Cpanel, then you can easily change upload limit from the UI. Under Software click on “Select PHP Version.”

Then —-> Click on “Switch to PHP Options.”

You can then click on each property and change its value. Then click on “Save.”

 

5- Using WordPress Plugins
If you don’t want to do it manually, there is always a plugin in the WordPress repository. You just need to find the right plugin that is compatible with your current WordPress version. Try using Increase Upload Max Filesize which is compatible with the latest version of WordPress.

How to increase Max Upload Size Limit in WordPress
You may Also Like
Scroll to top