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

This fault message can appear when you're uploading large images, videos, plugins, themes, any type of file that you lot upload to your WordPress site.

In this article, we're going to help you fix the problem and make it so that you tin upload those large files. In total, we'll cover:

  • What causes the uploaded file exceeds the upload_max_filesize directive in php.ini
  • How to fix 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

Permit's start at the commencement. In society to preserve your server's 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 crave PHP.

Those two things – upload_max_filesize and php.ini – are what the mistake message you see is referencing.

It's important to remember that this upload limit is not a WordPress setting. Even so, you lot can see this limit in your WordPress site if you become to Media → Add New:

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

As you tin can encounter above, Kinsta sets the default limit at 128 MB, which is quite big and unlikely to always cause issues. Nonetheless, a lot of other hosts set the default as small equally just 2 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 similar "file_name exceeds the maximum upload size for this site."

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

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

In that location are several different ways you can do this – the verbal method that you cull will depend on your preference and your host's configuration.

i. Talk to your host's support

While nosotros'll cover some methods that yous tin try by yourself, the simplest solution is unremarkably to just achieve out to your host'due south support and enquire them to increment the limit for you.

This is a common request, your host'southward support should know exactly what yous want, and it should only take a couple of minutes of your time. That's what your host's back up is there for!

If you host at Kinsta and need to increment your limit across the default 128 MB limit, you tin can achieve out to support on Intercom from anywhere in your Kinsta dashboard:

Kinsta 24x7 support
WordPress host support

2. Edit php.ini via cPanel

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

First, expect for the MultiPHP INI Editor:

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

And so choose your WordPress site from the drop-downward. After that, you lot'll be 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

Equally y'all learned above, the php.ini file controls how your server works for PHP applications.

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

However, you tin requite this a endeavor beginning to run into if you lot are immune to apply php.ini at your host.

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

If you already see 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 alter the code snippet below:

  • If yous created a new file, paste in the lawmaking snippet and change the numbers to conform your needs.
  • If you're editing an existing file, find the aforementioned directives in the existing file and modify the numbers to suit 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 farther crave y'all to add the suPHP directive in your site's .htaccess file in order for the changes higher up to actually work.

To practice this, you lot can also edit your .htaccess file via PHP and add the post-obit code nigh the top of the file:

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

Make sure to replace yourusername with the bodily file path of your site.

4. Increase 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 also try to change the upload_max_filesize directive by editing your site's .htaccess file.

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

Then, add together the following lawmaking snippet, making sure to conform 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 calculation this code snippet, your server is likely running PHP in CGI mode, which means y'all cannot use these commands in your .htaccess file. Remove the snippets you just added and your site should start functioning over again.

Annotation – if you're a Kinsta customer, Kinsta uses NGINX, which means your site does non have an .htaccess file. If you need help at Kinsta, we recommend but reaching out to our support team and they'll be able to quickly get things working for y'all.

Summary

To check if your changes are working, you can go back to Media → Add New in your WordPress dashboard to see if the new maximum upload limit matches the number you set in your php.ini file. If all goes well, you should encounter your new value and you'll be able to upload the file that was giving y'all problems.

Finally, if nothing you've tried is working and your host's support tin't help for some reason, you can always upload the file via FTP as a workaround. FTP has no limits and volition allow y'all upload everything from images to plugins and themes. Y'all tin can even bulk upload files if needed.


Salve time, costs and maximize site performance with:

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

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