Back to Blog

WordPress Upload Size Limit: How to Increase It

Fix The uploaded file exceeds the upload_max_filesize directive in php.ini: raise the WordPress upload limit in cPanel, DirectAdmin, .user.ini or on a VPS.

Nodesty Team9 min readHosting
The words WordPress Upload Limit with upload_max_filesize on a dark Nodesty background

The WordPress upload size limit is what stands behind the error "The uploaded file exceeds the upload_max_filesize directive in php.ini". You try to upload a theme, a plugin, a video or a backup, and WordPress refuses because the file is larger than PHP allows. The limit isn't a WordPress setting at all: it comes from a handful of PHP directives, and sometimes from the web server in front of PHP.

This guide covers where the limit shows up, the PHP directives behind it, raising it in cPanel and DirectAdmin, with .user.ini or .htaccess, on your own VPS with PHP-FPM and Nginx, why wp-config.php doesn't help, the multisite setting, uploading large files over SFTP and how to verify the new limit.

Where does the limit show up?

Open Media → Add New Media File (Add New in older versions). Below the upload box WordPress prints the current limit, for example "Maximum upload file size: 2 MB." What happens with a larger file depends on where you upload it:

WhereMessage
Media uploadervideo.mp4 exceeds the maximum upload size for this site.
Plugin or theme uploadThe uploaded file exceeds the upload_max_filesize directive in php.ini.
Plugin or theme above post_max_sizeThe link you followed has expired.
Any upload behind Nginx with a low limit413 Request Entity Too Large

All four have the same root: a size limit on the server that is lower than your file.

The PHP settings behind the limit

On a single site, WordPress reads two PHP values and shows the smaller one: upload_max_filesize and post_max_size. Three more settings decide whether a large upload actually finishes.

DirectiveWhat it limitsUsual defaultSensible value
upload_max_filesizeThe size of a single uploaded file2M64M
post_max_sizeThe whole request: all files plus the form fields8M64M
memory_limitThe memory one script may use128M256M
max_execution_timeThe seconds a script may run30300
max_input_timeThe seconds PHP may spend reading the upload60300
  • post_max_size must be equal to or larger than upload_max_filesize; otherwise the smaller value is your real limit. A little larger doesn't hurt.
  • The PHP manual recommends keeping memory_limit above post_max_size.
  • The time limits matter on slow connections and for the work after the upload, such as unpacking a theme or creating image sizes.
  • Choose values that fit your largest file. Very high limits let a single faulty or abusive request use up the server's resources.

Raise the limit in cPanel

  1. Open MultiPHP INI Editor in the Software section.
  2. In Basic Mode, choose your domain from the location menu.
  3. Set upload_max_filesize and post_max_size, and if needed memory_limit, max_execution_time and max_input_time.
  4. Click Apply.

cPanel writes the values into the php.ini, .user.ini and .htaccess files of that folder for you, so don't edit the block it generates by hand. On servers with CloudLinux, use Select PHP Version → Options and pick the values from the lists; these options belong to the selected PHP version, so set them again if you switch versions. Our How to change PHP version guide shows both screens. If the value you need isn't offered or doesn't take effect, the provider has capped it for your plan; ask support.

Raise the limit in DirectAdmin

DirectAdmin looks different depending on the skin and on what your provider has enabled. There are two common places:

  • PHP Settings: Choose the domain, add the directive from the list (for example upload_max_filesize) with its new value and save. Each domain keeps its own overrides.
  • Select PHP Version → Options: On servers with CloudLinux, the same screen as in cPanel.

If neither is available, or the directive you need isn't in the list, use the .user.ini method below or ask your provider; the server-wide php.ini is in the administrator's hands.

With a .user.ini file

With PHP-FPM, FastCGI and LiteSpeed, PHP reads a .user.ini file from the site's folder. Create it in the site's root folder (usually public_html, next to wp-config.php) with the file manager or over SFTP:

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

PHP caches this file and rereads it every five minutes by default (user_ini.cache_ttl), so wait a few minutes before you check. .user.ini is not read when PHP runs as an Apache module (mod_php), and it can't go above limits the server administrator has locked.

With .htaccess (php_value)

If PHP runs as an Apache module (mod_php) or the site is on LiteSpeed, you can set the values in the .htaccess file in the site's root folder. Put them above the # BEGIN WordPress line, because WordPress can rewrite the block between its own markers:

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

Warning: On Apache with PHP-FPM or another CGI setup, Apache doesn't know php_value, and the whole site answers with a 500 Internal Server Error (the error log says Invalid command 'php_value'). Remove the lines and the site is back; use .user.ini there. Nginx ignores .htaccess entirely. Not sure what your site runs on? Tools → Site Health → Info → Server shows the PHP SAPI: apache2handler is mod_php, fpm-fcgi is PHP-FPM and litespeed is LiteSpeed.

On your own VPS: php.ini and PHP-FPM

On Ubuntu and Debian, every PHP version and every way of running PHP has its own php.ini. For PHP-FPM with PHP 8.3 it is /etc/php/8.3/fpm/php.ini; ls /etc/php/ shows the installed versions. /etc/php/8.3/cli/php.ini only applies to the command line, which is why php -i can show different values from the website.

sudo nano /etc/php/8.3/fpm/php.ini

Find the existing lines and change them, together with the other values from the table if needed:

upload_max_filesize = 64M
post_max_size = 64M

PHP-FPM only reads the file when it starts, so restart it:

sudo systemctl restart php8.3-fpm

With Apache and mod_php the file is /etc/php/8.3/apache2/php.ini and you restart with sudo systemctl restart apache2. On AlmaLinux the file is /etc/php.ini and the service is called php-fpm.

413 Request Entity Too Large: the Nginx limit

Nginx has its own limit, client_max_body_size, and its default is only 1 MB. A larger request never reaches PHP: Nginx answers 413 Request Entity Too Large, which the media uploader often shows only as a generic HTTP error. This is a different limit from upload_max_filesize, so you have to raise both. Add the line to the http block in /etc/nginx/nginx.conf or to the site's server block:

client_max_body_size 64m;
sudo nginx -t
sudo systemctl reload nginx

If Nginx works as a reverse proxy in front of Apache or a container, the limit applies there too; our How to install Nginx guide covers the configuration. A proxy service such as Cloudflare adds its own upload cap, 100 MB on the free plan.

Why wp-config.php doesn't raise the limit

Many guides suggest a line such as @ini_set( 'upload_max_filesize', '64M' ); in wp-config.php or in the theme's functions.php. It has no effect: PHP receives and checks the upload before the first line of WordPress runs, and upload_max_filesize and post_max_size can't be changed at runtime with ini_set(). They can only be set in php.ini, .user.ini or the web server configuration.

define( 'WP_MEMORY_LIMIT', '256M' ); is a real setting, but it only raises the memory WordPress asks for, which helps with the memory errors in our WordPress critical error guide. The upload limit stays where it is. Plugins can't change PHP's limit either; some work around it by sending the file in small chunks, but fixing the server setting is cleaner.

WordPress multisite: Max upload file size

A multisite network has an extra limit on top of PHP's. Open Network Admin → Settings → Network Settings and find Max upload file size under Upload Settings. The value is in KB and defaults to 1500 KB, about 1.5 MB, so the sites of a new network stay at that limit even when PHP allows 64 MB. Enter for example 65536 for 64 MB and save. The smaller of the two limits always wins, and Site upload space in the same section can additionally cap the total space per site.

Workaround: upload large files over SFTP

For a single large file you don't have to raise anything:

  • Plugins and themes: Unzip the archive on your computer, upload the folder to wp-content/plugins or wp-content/themes over SFTP and activate it in wp-admin.
  • Whole sites: Don't push a multi-gigabyte backup through a plugin's upload form. Move files and the database directly, as described in our How to migrate a website guide.
  • Media files: A file copied into wp-content/uploads doesn't appear in the Media Library by itself, because every item needs a database entry. Upload the file to your home folder and register it with WP-CLI over SSH:
cd ~/public_html
wp media import ~/big-video.mp4

wp media import copies the file into the uploads folder and creates the library entry; add --skip-copy if the file already sits in wp-content/uploads.

Verify the new limit

  • Media → Add New Media File: The number below the upload box should show the new value.
  • Tools → Site Health → Info: The Server section lists "Upload max filesize", "PHP post max size", "PHP memory limit", "PHP time limit" and "Max input time"; Media Handling shows the "Max effective file size". You need an administrator account for this page; if you're locked out, see our Reset the WordPress admin password guide.

If the old value is still there, check the usual suspects: post_max_size is still lower, the .user.ini cache hasn't expired, you edited the php.ini of another PHP version or of the command line, PHP-FPM wasn't restarted, the provider caps the value, or the multisite setting is lower.

WordPress at Nodesty

Nodesty web hosting runs WordPress sites on AMD Ryzen 9 7900 servers with the LiteSpeed web server and NVMe storage. You choose the PHP version and edit php.ini settings such as upload_max_filesize and post_max_size from cPanel or DirectAdmin, with free SSL, Imunify360 and JetBackup backups included. If you want to set every limit yourself, from php.ini to client_max_body_size, our AMD Ryzen 9 9950X VPS plans give you full root access and free daily backups kept for 7 days. A fresh installation is covered in our How to install WordPress guide, and if the site shows a database message instead, see Error establishing a database connection.

Frequently Asked Questions

What is the default WordPress upload limit?

WordPress has no fixed limit of its own on a single site. It shows the smaller of the two PHP settings upload_max_filesize and post_max_size. PHP's own defaults are 2 MB and 8 MB, and hosting providers usually set higher values, which is why the limit differs from host to host.

What does The uploaded file exceeds the upload_max_filesize directive in php.ini mean?

The file you tried to upload is larger than the PHP setting upload_max_filesize allows, so PHP rejected it before WordPress could process it. Raise upload_max_filesize and post_max_size in the control panel, in a .user.ini file or in php.ini, or upload the file over SFTP instead.

I changed the values but the limit is still the same. Why?

The most common reasons are that post_max_size is still lower than upload_max_filesize, the change was made for a different PHP version or in the command line php.ini, PHP-FPM wasn't restarted, or a .user.ini file hasn't been reread yet, which can take five minutes. On shared hosting the provider may also cap the value, and on multisite the network setting applies on top.

Can I increase the upload limit in wp-config.php?

No. upload_max_filesize and post_max_size can't be changed while a script is running, so ini_set lines in wp-config.php or functions.php have no effect. WP_MEMORY_LIMIT only raises the memory limit. The upload limit has to be changed in php.ini, .user.ini, .htaccess or the control panel.

What is the difference between the upload_max_filesize error and 413 Request Entity Too Large?

The first comes from PHP, the second from the web server. Nginx rejects any request larger than client_max_body_size, which is 1 MB by default, before it reaches PHP. On your own server you have to raise both limits; raising only one leaves the other in place.

How high should I set the upload limit?

A little above the largest file you really upload. 64 MB is enough for most sites, and 128 or 256 MB covers large themes and backups. Avoid extreme values, since they let a single request tie up memory, disk space and PHP workers. For the occasional very large file, SFTP is the better tool.

Nodesty

About the author

Nodesty Team · Infrastructure & Support

The Nodesty team runs our servers, network and DDoS protection day to day and answers customer support requests around the clock. These guides come from that work.

Related articles

Launch your server now.

Build, scale, and conquer without limits on Nodesty's premium infrastructure.

                                                                                                                                                                                                                            
                                                                                                                                                                                                                            
                                                                                                                                                                                                                            
                                                                                                                             ············································                                                   
                                                ··································································································..........···························                                     
                                       ················..........................................................................................................................··············                             
                                  ·············.................::::::::::::::::::::::::::::::::::::::::::::::....................:::::::::::::::::::::::::::::::::::::::................···········                        
                             ············................:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::............·········                     
                         ············.................:::::::::::::::::::::::::::::::::::::::::::::::::::------------::::::::::::::::::::::::::::::----------------:::::::::::::::::::::..........········                  
                    ············......................::::::::::::::::::::::::::::::::::::------------------------------------------------------------------------------------:::::::::::::.........········                
                ··········.............................................::::::::::::::::::-------------==========================================-----------------------------------:::::::::::........·······               
             ········..................:.....................................::::::::::--------=======+++++++++++++++++++++++++++++++++++++=========================------------------::::::::::.......·······              
           ······.........::::::::::::::::::::................................:::::::-----=====++++xxxxxx**************************xxxxxxxxx++++++++++++++===================------------::::::::.......·······             
          ·····.......:::::::::::::::::::::::::::.............................:::::----===+++xxx****%%%%&&&&&&#############&&&&&&&%%%%%*******xxxxxxxx++++++++++++++==============----------:::::::......······             
         ····......::::::::-------------:::::::::::..........................::::---===+++xx***%%%&&&####@@@@@@@@@@@@@@@@@@@@@@@@####&&&&&%%%%*******xxxxxxxxx+++++++++++++===========--------::::::......·····             
        ····.....:::::::--------------------:::::::::.......................::::---===++xxx**%%&&&###@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@###&&&&%%%%%********xxxxxxxxxxx++++++++++++========------::::::.....······            
        ····.....:::::--------------------------::::::::....................::::---===++xx***%%&&&####@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@###&&&&&%%%%%**********xxxxxxxxxxxxx+++++++++=======------:::::.....·····            
        ····....::::::-------=============---------:::::::::................:::::---===+++xx***%%%&&&#####@@@@@@@@@@@@@@@@@@@@@@@@@#####&&&&&%%%%%%*************xxxxxxxxxxxxxx+++++++++======-----:::::....·····            
         ····....:::::-------================---------:::::::::...............:::::----===++++xxx***%%%%&&&&&&#################&&&&&&%%%%%%%*******************xxxxxxxxxxxxxxxxx++++++++======----:::::....·····            
         ·····....:::::--------=================---------::::::::::..............:::::::-----====+++++xxxxxx**************************xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx++++++++=====-----::::....·····            
          ·····.....:::::--------=================----------:::::::::::.................:::::::::-------=============++++++++++++++++++++++++++++++++++++xxxxxxxxxxxxxxxxxxxxxxx++++++++======-----::::....·····            
            ·····.....:::::::----------===========-------------::::::::::::.........................::::::::::::::::::------------------=============+++++++++++++++++++++++++++++++++=======-----::::.....·····            
              ······......:::::::---------------------------------:::::::::::::........................................:::::::::::::::-----------============+++++++++++++++++++++========------:::::.....·····             
                 ······........:::::::::---------------------------:::::::::::::::::...........................................:::::::::::::------------=============================--------::::::.....······              
                    ·········.........:::::::::::::::-------------::::::::::::::::::::::::.......................................::::::::::::::::--------------------------------------::::::::......·······                
                          ··········............::::::::::::::::::::::::::::::::::::::::::::::::::................................::::::::::::::::::::::::::-------------:::::::::::::::.........········                   
                                  ············..................:::::::::::::::::::::::::::::::::::::::::::.........................:::::::::::::::::::::::::::::::::::::................···········                        
                                             ················.............................................................................................................·················                                 
                                                           ······················................................................................···························                                                
                                                                               ·········································································