Ec2 the Uploaded File Exceeds the Upload_max_filesize Directive in Php.ini.
Trying to upload something to your WordPress site merely to exist met with a message maxim "the uploaded file exceeds the upload_max_filesize directive in php.ini"?
This error bulletin can appear when you're uploading large images, videos, plugins, themes, any type of file that you upload to your WordPress site.
In this commodity, we're going to assistance you fix the problem and make it and so that y'all can upload those large files. In total, nosotros'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
Let'south offset at the showtime. In social club to preserve your server's resources, hosts set up a limit on the maximum size of a file that 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 2 things – upload_max_filesize and php.ini – are what the error message you see is referencing.
It's of import to retrieve that this upload limit is not a WordPress setting. However, you can encounter this limit in your WordPress site if you lot go to Media → Add New:
As you tin can see above, Kinsta sets the default limit at 128 MB, which is quite large and unlikely to ever cause issues. Nevertheless, a lot of other hosts set the default every bit small every bit only 2 MB or 4 MB.
That means if yous 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 Ready the uploaded file exceeds the upload_max_filesize directive in php.ini
In order to set this mistake, yous need to increment 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.
There are several different ways you can practice this – the verbal method that you choose will depend on your preference and your host's configuration.
1. Talk to your host'southward back up
While we'll encompass some methods that y'all can try past yourself, the simplest solution is usually to just reach out to your host's back up and enquire them to increase the limit for you.
This is a common request, your host's back up should know exactly what you desire, and it should simply accept a couple of minutes of your fourth dimension. That's what your host'due south support is there for!
If you host at Kinsta and demand to increase your limit across the default 128 MB limit, you can reach out to support on Intercom from anywhere in your Kinsta dashboard:
2. Edit php.ini via cPanel
If your host uses cPanel, you lot should be able to edit your php.ini file and upload_max_filesize directive via the cPanel dashboard.
First, look for the MultiPHP INI Editor:
And then choose your WordPress site from the drop-down. After that, you lot'll exist able to edit the upload_max_filesize directive for that site:
Subscribe Now
Increase the value based on your needs.
three. Create or edit php.ini via FTP
Equally you learned to a higher place, the php.ini file controls how your server works for PHP applications.
Unfortunately, based on your host's restrictions, y'all may or may not exist able to utilize php.ini files. For that reason, a more than reliable approach can sometimes exist to use .htaccess (which nosotros'll cover in the next section).
Nevertheless, you tin can give this a try first to see if you are allowed to utilize 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 run into a php.ini file in the root folder, you tin can edit that file. Otherwise, create a new file and name information technology php.ini:
And so add 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 change the numbers to suit your needs.
upload_max_filesize = 12M
post_max_size = 13M
memory_limit = 15M
Some hosts might further crave you lot to add the suPHP directive in your site'south .htaccess file in order for the changes above to actually work.
To do this, you can likewise edit your .htaccess file via PHP and add the post-obit code near the acme 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. Increase upload_max_filesize value by editing .htaccess
If straight creating or editing the php.ini file via the methods to a higher place didn't work, you tin also try to modify 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'south located in your site'southward root folder.
So, add the post-obit code snippet, making certain to adjust the values based on your needs:
php_value upload_max_filesize 12M
php_value post_max_size 13M
php_value memory_limit 15M
If y'all get an internal server error message after adding this code snippet, your server is probable running PHP in CGI way, which means you lot cannot employ these commands in your .htaccess file. Remove the snippets y'all but added and your site should start functioning again.
Annotation – if you're a Kinsta customer, Kinsta uses NGINX, which means your site does not have an .htaccess file. If you demand assist at Kinsta, nosotros recommend just reaching out to our back up squad and they'll be able to quickly become things working for you.
Summary
To check if your changes are working, you lot can go back to Media → Add New in your WordPress dashboard to run across if the new maximum upload limit matches the number you set in your php.ini file. If all goes well, you should meet your new value and y'all'll be able to upload the file that was giving you issues.
Finally, if aught y'all've tried is working and your host's support tin can't assistance for some reason, you can ever upload the file via FTP equally a workaround. FTP has no limits and will allow you upload everything from images to plugins and themes. You can even bulk upload files if needed.
Save time, costs and maximize site operation with:
- Instant aid 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 one plan with no long-term contracts, assisted migrations, and a 30-day-money-dorsum-guarantee. Check out our plans or talk to sales to detect the programme that's correct for you.
Source: https://kinsta.com/knowledgebase/the-uploaded-file-exceeds-the-upload_max_filesize-directive-in-php-ini/
0 Response to "Ec2 the Uploaded File Exceeds the Upload_max_filesize Directive in Php.ini."
Post a Comment