Trying to upload something to your WordPress site simply to be met with a message proverb "the uploaded file exceeds the upload_max_filesize directive in php.ini"?

This error bulletin tin appear when you're uploading big images, videos, plugins, themes, any type of file that you upload to your WordPress site.

In this article, we're going to help you ready the problem and brand it so that y'all tin upload those big files. In total, we'll embrace:

  • What causes the uploaded file exceeds the upload_max_filesize directive in php.ini
  • How to set up the uploaded file exceeds the upload_max_filesize directive in php.ini

What Causes the uploaded file exceeds the upload_max_filesize directive in php.ini

An example of the uploaded file exceeds the upload_max_filesize directive in php.ini
An example of the uploaded file exceeds the upload_max_filesize directive in php.ini

Allow's first at the kickoff. In order to preserve your server'southward resources, hosts set a limit on the maximum size of a file that can be uploaded.

This maximum, in megabytes, is defined in the upload_max_filesize directive.

The upload_max_filesize directive itself is located in the php.ini file, which is the default server configuration file for applications that require PHP.

Those ii things – upload_max_filesize and php.ini – are what the error message y'all see is referencing.

Information technology's important to call back that this upload limit is non a WordPress setting. Even so, you tin run across this limit in your WordPress site if you get to Media → Add New:

How to check upload limit in WordPress
How to check upload limit in WordPress

Every bit you can see above, Kinsta sets the default limit at 128 MB, which is quite large and unlikely to always cause issues. Nevertheless, a lot of other hosts set the default as pocket-size as just ii MB or 4 MB.

That means if you try to upload a file larger than that limit, you're going to see the "the uploaded file exceeds the upload_max_filesize directive in php.ini", or a similar message like "file_name exceeds the maximum upload size for this site."

How to Fix the uploaded file exceeds the upload_max_filesize directive in php.ini

In order to gear up this fault, you demand to increase the file size upload limit. That is, you need to increase the value of the upload_max_filesize directive in your php.ini file.

At that place are several different means you can practice this – the exact method that you choose will depend on your preference and your host's configuration.

one. Talk to your host's back up

While we'll embrace some methods that you can endeavour by yourself, the simplest solution is usually to just reach out to your host'southward back up and ask them to increase the limit for you lot.

This is a common asking, your host's back up should know exactly what you want, and it should simply have a couple of minutes of your fourth dimension. That's what your host's support is there for!

If yous host at Kinsta and need to increase your limit across the default 128 MB limit, y'all can attain out to back up on Intercom from anywhere in your Kinsta dashboard:

Kinsta 24x7 support
WordPress host support

ii. Edit php.ini via cPanel

If your host uses cPanel, you should be able to edit your php.ini file and upload_max_filesize directive via the cPanel dashboard.

First, wait for the MultiPHP INI Editor:

The MultiPHP INI Editor in cPanel
The MultiPHP INI Editor in cPanel

Then choose your WordPress site from the drop-down. Afterwards that, you'll exist able to edit the upload_max_filesize directive for that site:

Subscribe Now

Changing the upload_max_filesize directive in cPanel
Irresolute the upload_max_filesize directive in cPanel

Increase the value based on your needs.

3. Create or edit php.ini via FTP

As you lot learned to a higher place, the php.ini file controls how your server works for PHP applications.

Unfortunately, based on your host'south restrictions, you may or may not exist able to use php.ini files. For that reason, a more than reliable arroyo can sometimes be to use .htaccess (which we'll comprehend in the next section).

However, yous can give this a try first to come across if y'all are allowed to use php.ini at your host.

To get started, connect to your server via FTP and go to your site'south root folder.

If you already encounter a php.ini file in the root folder, you can edit that file. Otherwise, create a new file and name it php.ini:

How to create a new php.ini file
How to create a new php.ini file

Then add or modify the code snippet below:

  • If you created a new file, paste in the lawmaking snippet and modify the numbers to suit your needs.
  • If you're editing an existing file, find the same directives in the existing file and change the numbers to arrange your needs.

upload_max_filesize = 12M
post_max_size = 13M
memory_limit = 15M

Adding the code to the php.ini file
Adding the code to the php.ini file

Some hosts might further require y'all to add together the suPHP directive in your site's .htaccess file in order for the changes higher up to really work.

To do this, you can also edit your .htaccess file via PHP and add the following code near the top of the file:

<IfModule mod_suphp.c>
suPHP_ConfigPath /home/yourusername/public_html
</IfModule>

Brand sure to supercede yourusername with the actual file path of your site.

4. Increment upload_max_filesize value by editing .htaccess

If directly creating or editing the php.ini file via the methods above didn't work, you can likewise attempt to alter the upload_max_filesize directive by editing your site's .htaccess file.

To get started, connect to your site via FTP and edit the .htaccess file that's located in your site's root folder.

So, add the following code snippet, making sure to arrange the values based on your needs:

php_value upload_max_filesize 12M
php_value post_max_size 13M
php_value memory_limit 15M

How to control php.ini file via .htaccess
How to control php.ini file via .htaccess

If you become an internal server error message after adding this code snippet, your server is probable running PHP in CGI mode, which means yous cannot use these commands in your .htaccess file. Remove the snippets y'all just added and your site should starting time functioning again.

Notation – if you're a Kinsta customer, Kinsta uses NGINX, which ways your site does not take an .htaccess file. If you demand help at Kinsta, nosotros recommend simply reaching out to our back up squad and they'll be able to quickly get things working for you.

Summary

To check if your changes are working, you tin get dorsum to Media → Add New in your WordPress dashboard to encounter if the new maximum upload limit matches the number you fix in your php.ini file. If all goes well, you should run into your new value and you'll exist able to upload the file that was giving you problems.

Finally, if cypher yous've tried is working and your host's back up can't help for some reason, you can always upload the file via FTP as a workaround. FTP has no limits and will let yous upload everything from images to plugins and themes. You tin fifty-fifty bulk upload files if needed.


Salvage time, costs and maximize site performance with:

  • Instant help from WordPress hosting experts, 24/vii.
  • Cloudflare Enterprise integration.
  • Global audience reach with 29 information centers worldwide.
  • Optimization with our built-in Application Performance Monitoring.

All of that and much more than, in one programme with no long-term contracts, assisted migrations, and a 30-day-money-back-guarantee. Check out our plans or talk to sales to find the plan that's right for you.