Trying to upload something to your WordPress site only to exist 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 big images, videos, plugins, themes, whatsoever type of file that you lot upload to your WordPress site.

In this article, we're going to help you set up the trouble and make information technology so that you can 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 instance of the uploaded file exceeds the upload_max_filesize directive in php.ini

Let's start at the start. In order to preserve your server'southward resources, hosts set a limit on the maximum size of a file that tin can exist 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 two things – upload_max_filesize and php.ini – are what the mistake bulletin you run across is referencing.

Information technology's important to remember that this upload limit is not a WordPress setting. Withal, you can see this limit in your WordPress site if yous become to Media → Add together New:

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

As you tin can come across to a higher place, Kinsta sets the default limit at 128 MB, which is quite big and unlikely to ever crusade issues. However, a lot of other hosts set up the default as small-scale as but 2 MB or 4 MB.

That means if you lot effort to upload a file larger than that limit, you're going to come across 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 fix this mistake, you lot need to increase the file size upload limit. That is, you lot need to increase the value of the upload_max_filesize directive in your php.ini file.

In that location are several different ways yous can exercise this – the exact method that you choose will depend on your preference and your host'south configuration.

1. Talk to your host'southward back up

While we'll cover some methods that you can try by yourself, the simplest solution is usually to just accomplish out to your host'southward support and ask them to increment the limit for you.

This is a common request, your host's support should know exactly what y'all want, and information technology should only take a couple of minutes of your fourth dimension. That's what your host's support is there for!

If you host at Kinsta and need to increase your limit beyond the default 128 MB limit, y'all tin reach 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, you should exist able to edit your php.ini file and upload_max_filesize directive via the cPanel dashboard.

Starting time, await 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-downward. After that, you lot'll exist able to edit the upload_max_filesize directive for that site:

Subscribe Now

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

Increase the value based on your needs.

3. Create or edit php.ini via FTP

Every bit you learned above, the php.ini file controls how your server works for PHP applications.

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

Nonetheless, you can requite this a try first to encounter if you are allowed to use php.ini at your host.

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

If you lot already come across a php.ini file in the root folder, you can edit that file. Otherwise, create a new file and proper noun it php.ini:

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

Then add or modify the lawmaking snippet beneath:

  • If you created a new file, paste in the code snippet and modify the numbers to accommodate your needs.
  • If yous're editing an existing file, find the aforementioned directives in the existing file and change 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 further require you to add together the suPHP directive in your site'south .htaccess file in order for the changes above to actually work.

To exercise this, you can as well edit your .htaccess file via PHP and add the post-obit 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. 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 modify the upload_max_filesize directive by editing your site'south .htaccess file.

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

Then, add the post-obit code snippet, making sure to suit 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 yous get an internal server error message later calculation this code snippet, your server is probable running PHP in CGI mode, which ways you cannot utilise these commands in your .htaccess file. Remove the snippets y'all just added and your site should start operation again.

Notation – if you're a Kinsta customer, Kinsta uses NGINX, which means your site does not have an .htaccess file. If you need aid at Kinsta, nosotros recommend just reaching out to our support team and they'll exist able to quickly become things working for you.

Summary

To check if your changes are working, you can become dorsum to Media → Add New in your WordPress dashboard to come across if the new maximum upload limit matches the number you prepare in your php.ini file. If all goes well, you should see your new value and you'll exist able to upload the file that was giving you problems.

Finally, if goose egg you've tried is working and your host's support tin can't assistance for some reason, you can ever upload the file via FTP as a workaround. FTP has no limits and volition let y'all upload everything from images to plugins and themes. You tin can fifty-fifty bulk upload files if needed.


Save fourth dimension, costs and maximize site performance with:

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

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