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

This error message tin announced when you lot're uploading large images, videos, plugins, themes, any blazon of file that you upload to your WordPress site.

In this article, we're going to help you set up the problem and make information technology and so that yous can upload those large files. In full, we'll comprehend:

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

Allow'due south get-go at the starting time. In order 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 require PHP.

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

It'due south important to remember that this upload limit is not a WordPress setting. Still, y'all can see this limit in your WordPress site if you go to Media → Add New:

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

Equally y'all tin can meet to a higher place, Kinsta sets the default limit at 128 MB, which is quite large and unlikely to ever crusade issues. However, a lot of other hosts gear up the default as minor as just ii MB or iv MB.

That ways if you attempt to upload a file larger than that limit, y'all'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 Set the uploaded file exceeds the upload_max_filesize directive in php.ini

In order to fix this error, y'all need to increase the file size upload limit. That is, you lot need to increment the value of the upload_max_filesize directive in your php.ini file.

There are several dissimilar ways y'all can exercise this – the exact method that y'all choose will depend on your preference and your host's configuration.

1. Talk to your host'southward back up

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

This is a mutual request, your host'due south support should know exactly what y'all desire, and it should simply accept a couple of minutes of your time. That'southward what your host'south support is there for!

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

Kinsta 24x7 support
WordPress host support

two. Edit php.ini via cPanel

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

Start, look 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-down. After that, you'll be able to edit the upload_max_filesize directive for that site:

Subscribe At present

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

Equally you learned higher up, the php.ini file controls how your server works for PHP applications.

Unfortunately, based on your host's restrictions, yous may or may not be able to use php.ini files. For that reason, a more reliable approach can sometimes exist to use .htaccess (which we'll comprehend in the side by side section).

Even so, you lot tin give this a attempt showtime to come across if you are allowed to utilise php.ini at your host.

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

If you already see a php.ini file in the root binder, you lot 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

And then add or modify the lawmaking snippet below:

  • If you created a new file, paste in the lawmaking snippet and change the numbers to suit 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 further require you to add the suPHP directive in your site's .htaccess file in guild for the changes in a higher place to actually piece of work.

To exercise this, yous can besides edit your .htaccess file via PHP and add the post-obit code near the top of the file:

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

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

four. Increase upload_max_filesize value past editing .htaccess

If directly creating or editing the php.ini file via the methods above didn't work, you can also endeavour to change 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'south located in your site's root folder.

Then, add the post-obit lawmaking snippet, making sure to adapt 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 mistake message subsequently adding this code snippet, your server is likely running PHP in CGI way, which means you cannot use these commands in your .htaccess file. Remove the snippets you but added and your site should outset functioning again.

Note – if you're a Kinsta customer, Kinsta uses NGINX, which means your site does not have an .htaccess file. If you demand help at Kinsta, we recommend just reaching out to our back up team and they'll exist able to quickly get things working for you.

Summary

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

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


Salvage fourth dimension, costs and maximize site performance with:

  • Instant help from WordPress hosting experts, 24/7.
  • Cloudflare Enterprise integration.
  • Global audience attain with 29 data centers worldwide.
  • Optimization with our born 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 observe the plan that's correct for y'all.