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

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

In this commodity, nosotros're going to help yous gear up the problem and brand it so that you tin can upload those big files. In total, nosotros'll embrace:

  • 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 example of the uploaded file exceeds the upload_max_filesize directive in php.ini

Allow's start at the first. In order to preserve your server's resources, hosts set up a limit on the maximum size of a file that tin 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 run into is referencing.

It'southward of import to recall that this upload limit is non a WordPress setting. However, you tin 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 can see above, Kinsta sets the default limit at 128 MB, which is quite large and unlikely to always crusade bug. However, a lot of other hosts gear up the default as small as just 2 MB or 4 MB.

That ways if you try to upload a file larger than that limit, y'all're going to run into 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 set this error, you lot need to increase the file size upload limit. That is, y'all need to increase the value of the upload_max_filesize directive in your php.ini file.

There are several unlike means you can practise this – the verbal method that yous choose volition depend on your preference and your host's configuration.

i. Talk to your host's support

While we'll cover some methods that you lot can attempt by yourself, the simplest solution is ordinarily to but reach out to your host's support and enquire them to increment the limit for you.

This is a common asking, your host'south support should know exactly what you 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 y'all host at Kinsta and need to increase your limit beyond the default 128 MB limit, you can reach 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, you 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

Then choose your WordPress site from the driblet-downwardly. After that, you'll be 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

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

Unfortunately, based on your host's restrictions, y'all may or may non exist able to use php.ini files. For that reason, a more reliable approach can sometimes be to use .htaccess (which we'll cover in the adjacent section).

However, y'all can give this a try start to see if yous 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 folder.

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

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

Then add together or modify the code snippet below:

  • If yous 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 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 crave you to add the suPHP directive in your site'south .htaccess file in order for the changes in a higher place to actually work.

To do this, you tin also edit your .htaccess file via PHP and add the following code well-nigh the tiptop of the file:

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

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

4. Increment upload_max_filesize value by editing .htaccess

If straight creating or editing the php.ini file via the methods higher up didn't work, y'all can also try to change the upload_max_filesize directive past editing your site'southward .htaccess file.

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

So, add together the following code snippet, making certain 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 yous get an internal server error message afterwards adding this lawmaking snippet, your server is probable running PHP in CGI mode, which ways y'all cannot use these commands in your .htaccess file. Remove the snippets y'all simply added and your site should start functioning once again.

Note – if you're a Kinsta customer, Kinsta uses NGINX, which means your site does not take an .htaccess file. If you need assist at Kinsta, nosotros recommend just reaching out to our support squad and they'll be able to chop-chop get things working for you.

Summary

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

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


Save time, costs and maximize site performance with:

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

All of that and much more, in ane plan with no long-term contracts, assisted migrations, and a 30-mean solar day-money-back-guarantee. Cheque out our plans or talk to sales to find the program that'due south right for you.