How to Fix “The Uploaded File Exceeds the upload_max_filesize Directive in php.ini”
“The uploaded file exceeds the upload_max_filesize directive in php.ini” means the file you’re uploading is bigger than the upload limit set in PHP on your server. To fix it, raise two PHP settings, upload_max_filesize and post_max_size, in your hosting panel, a .user.ini file, php.ini or .htaccess, depending on your server. WordPress settings and wp-config.php can’t raise this limit.
I reproduced the error and tested the fixes on WordPress 7.1.4 with PHP 8.2 (PHP-FPM on nginx), November 2026. The cPanel screenshots in Methods 1 and 4 come from a standard cPanel account.
| Your hosting | Best fix |
|---|---|
| cPanel (most shared hosting) | Method 1: MultiPHP INI Editor |
| Another host panel (Plesk, hPanel, a managed WordPress dashboard) | Look for “PHP settings” in the panel, or Method 2 |
| Any host running PHP-FPM, including nginx servers | Method 2: a .user.ini file |
| Your own VPS or server | Method 3: php.ini |
| Apache with mod_php, or LiteSpeed | Method 4: .htaccess |
| None of these work | Method 5: ask your host |
Where You’ll See This Error
You’ll usually see the exact message when you upload a plugin or theme ZIP in Plugins > Add Plugin > Upload Plugin or Appearance > Themes > Add Theme > Upload Theme. On my test site, with the limit set to 2 MB, uploading a 4.4 MB plugin ZIP stopped on this screen:

In the media uploader, the same problem shows up differently: WordPress checks the size first and says the file “exceeds the maximum upload size for this site”. The fix is the same.
Step 1: Check Your Current Limit
Go to Media > Add Media File. Below the upload box, WordPress shows Maximum upload file size:

For the exact PHP values, go to Tools > Site Health > Info and open Server. Note Upload max filesize and PHP post max size, and check PHP SAPI: if it says fpm-fcgi, your server uses PHP-FPM, so Method 2 is the one to try.

Pick a new limit a little above your biggest file. 64M or 128M covers most plugins, themes and media. Set post_max_size to the same value or higher, because PHP rejects the whole upload if it’s larger than post_max_size.
Method 1: Use the MultiPHP INI Editor in cPanel
If your host uses cPanel, this is the easiest fix, and you don’t have to edit any files yourself.
Log in to cPanel and open MultiPHP INI Editor in the Software section:

Choose your website’s domain or folder from the drop-down menu:

Find post_max_size and enter a new value, such as 128M:


Then find upload_max_filesize, enter the same value or a smaller one, and click Apply:


Go back to Media > Add Media File in WordPress and check that the new limit shows. The screenshots above use 5000M, which is far more than most sites need; a value close to your largest file is safer.
Method 2: Create a .user.ini File
Most hosts now run PHP-FPM, which reads a file called .user.ini in your site’s folder. This is the method I tested on my lab site.
- Open your host’s file manager, or connect with SFTP, and go to your WordPress folder (the one with
wp-config.php, oftenpublic_html). - Open
.user.iniif it exists, or create it. The name starts with a dot, so turn on “show hidden files” if you can’t see it. - Add these two lines and save:
upload_max_filesize = 128M
post_max_size = 128M
Then wait. PHP re-reads .user.ini only every 5 minutes by default (the user_ini.cache_ttl setting is 300 seconds), so the new limit didn’t appear on my test site until about five minutes later. After that, Site Health showed the new values:

The same 4.4 MB plugin ZIP that failed earlier then uploaded and installed without an error:

If nothing changes after 10 minutes, your host may not read .user.ini. Try Method 1, 3 or 5 instead.
Method 3: Edit php.ini (VPS and Your Own Server)
On a VPS or dedicated server, edit the main php.ini. To find it, run php --ini on the server, or look for Loaded Configuration File in a phpinfo() page. PHP-FPM usually uses a different file from the command line, so check the one for your web server. Change the two lines:
upload_max_filesize = 128M
post_max_size = 128M
Then restart PHP-FPM or your web server so it picks up the change. On shared hosting, a php.ini you upload to public_html is often ignored; use Method 1 or 2 there.
Method 4: Edit .htaccess (Apache With mod_php, or LiteSpeed Only)
On Apache servers that run PHP as a module, and on LiteSpeed, you can set PHP values in .htaccess in your WordPress folder. Add these lines above # BEGIN WordPress:
php_value upload_max_filesize 128M
php_value post_max_size 128M
Warning: on Apache servers that run PHP through PHP-FPM, php_value lines in .htaccess cause a 500 Internal Server Error across the whole site, and nginx ignores .htaccess completely. Download a backup of the file first, and if the site breaks, remove the lines straight away. If Site Health shows fpm-fcgi, use Method 2 instead.
On cPanel, the MultiPHP INI Editor (Method 1) writes these blocks into .htaccess for you, inside <IfModule> sections, so it’s safer to change the values there than to edit them by hand:

Method 5: Ask Your Host
Some hosts set a hard limit you can’t raise yourself, or use their own control panel. Ask their support to raise upload_max_filesize and post_max_size to the value you need. It’s a routine request that most support teams handle in a few minutes. If you’d rather have someone sort it out for you, I can fix your WordPress site.
What Doesn’t Work: wp-config.php and ini_set
Many tutorials tell you to add @ini_set( 'upload_max_filesize', '128M' ); to wp-config.php. It doesn’t work. PHP only lets you set upload_max_filesize and post_max_size in configuration files, not from code, so PHP ignores the line, and the @ hides the failure.
I tested it on my lab site: a page that called ini_set( 'upload_max_filesize', '64M' ) still reported the server’s limit (300M before, and 2M once I lowered it in .user.ini). Plugins that promise to raise the limit only work if they write to .user.ini or .htaccess for you.
Still Seeing the Error?
- The new limit doesn’t show yet. Wait 5 minutes for
.user.ini, or restart PHP after editingphp.ini. - Wrong folder. The file must be in the folder that holds
wp-config.php, not inwp-content. - post_max_size is smaller. If
post_max_sizeis lower thanupload_max_filesize, large uploads still fail. Set both. - You see “413 Request Entity Too Large” instead. That limit comes from the web server (for example nginx’s
client_max_body_size) or a proxy, not PHP. Ask your host to raise it. Cloudflare’s Free and Pro plans also cap uploads at 100 MB. - Big files time out. Very large uploads may also need a higher
max_execution_timeandmemory_limit. If you see “Allowed memory size exhausted”, follow how to fix the memory exhausted error.
For other upload and update problems, see the WordPress troubleshooting tutorials, or start with how to use WordPress if you’re new to the dashboard.
