E Uploaded File Exceeds the Upload_max_filesize Directive in Phpini
Themeisle content is gratis. When you purchase through referral links on our site, we earn a commission. Learn More
Did you just try to upload a file to your WordPress site only to exist met by an error bulletin saying "the uploaded file exceeds the upload_max_filesize directive in PHP.ini"?
The error occurs when yous are trying to upload a large file which can be an image, plugin, theme, or video. If the file size of the upload exceeds the maximum upload size configuration on your hosting server, y'all'll run into this error message.
The fix? Edit your server's configuration settings to increase the maximum upload filesize.
In this article, we are going to assist yous resolve this issue by extending the server'south default file upload limit.
Don't worry, information technology's non equally difficult equally information technology sounds. We volition share four unlike methods and you tin choose whichever method y'all discover comfortable and easy to execute.
📚 Table of contents:
- Modify PHP configurations on cPanel
- Edit the .htaccess file
- Edit the wp-config.php file
- Update php.ini via FTP
What causes the "the uploaded file exceeds the upload_max_filesize directive in PHP.Ini" error?
In the introduction, nosotros talked about how your hosting prevents large files like images, videos, plugins, or themes from being uploaded to the server. They want to ensure that the server resource are being fairly shared among its users. Past putting a cap on the file size, they make certain that no single website is using a disproportionate amount of server space or retentivity.
In WordPress, y'all tin can check your upload limit past opening the Media Library upload area – Media > Add New.

The good news is you can overcome this hurdle by changing the default limit. Notwithstanding, there are risks involved. One of the most common risks that you run into is past making the slightest of fault in the .htaccess or wp-config file and your entire website would come down crashing.
To safeguard your site from such a nightmare, we recommend taking a backup of your website before trying any of the tips in this commodity.
How to prepare the "upload_max_filesize" error in WordPress
To upload a large file into your website, all you lot need to do is increment the upload limit on your server. We'll share four different methods to reach this – at to the lowest degree one of them should work for your site.
Note: Yous can adjust the upload limit to the desired value as long equally your hosting provider supports information technology. If your file size is 10MB and your hosting supports up to 8MB, then you lot'd take to move to a ameliorate hosting provider.
To observe your PHP retentivity limit, get to Tools > Site Wellness > Info.

1. Modify PHP configurations on cPanel
Let'due south starting time with the easiest method, which should piece of work fine as long every bit your host uses cPanel for the hosting dashboard.
If your hosting provider doesn't offer cPanel, you tin can try 1 of the other options on this list.
Here'due south how to increment the max upload size in cPanel:
- Log into your hosting business relationship.
- Open cPanel.
- Become to Select PHP Version > PHP Options/Options. Or, in some situations, you might need to look for a tool called MultiPHP INI Editor.
- Change the value for
upload_max_filesize
according to your needs.

2. Edit the .htaccess file
The .htaccess file lets you control key configuration details for your spider web server. On many hosts, you can edit this file to increment the max upload filesize limit
Needless to say, it'southward an extremely crucial file and should be handled with caution.
To commencement, connect to your server using an FTP client. If you lot're not sure how to practise that, follow our detailed FTP guide.
Before making whatsoever changes, download a copy of the .htaccess file onto your computer as a backup option. That way, if you run into a problem, you can just delete the edited file from your website and upload the old file to make things get back to how they were.

Once you take your backup copy, correct-click to edit the file on your server. Then, add the post-obit lawmaking snippet and adjust the values based on your need:
php_value upload_max_filesize 128M php_value post_max_size 128M php_value memory_limit 128M

Close the file, become to your website, and check whether you tin upload large files.
Some of you lot may encounter the post-obit error afterwards inserting the code – Warning: PHP runs in CGI-mode.
If y'all see this bulletin, information technology means yous can't use this command in the .htacess file because of how your hosting surround is configured. Remove the code snippet and attempt some of the next methods.
3. Edit the wp-config.php file
The wp-config.php
file contains of import configuration details for your WordPress site. Without the config file, you will lose access to your site's content. Handle the file carefully.
As part of those configuration details, y'all can make changes to the maximum upload limit on your site.
To begin, connect to your website using an FTP client and download a copy of the wp-config.php
file as a safety internet. If annihilation goes wrong, yous tin can reupload this copy to your site to make things become dorsum to how they were.
Next, edit the file and insert the following code snippet above the /* That's all, cease editing!
line as shown in the image below. Brand sure to change the value based on how big files are to be allowed on your website.
@ini_set('upload_max_size' , '128M' );

Save the file, go out, and cheque if you tin can upload big files to your website. If you can't upload the file, then try the next method.
four. Update php.ini via FTP (didn't work for us)
The php.ini is a configuration file and modifying it will override your server settings. Updating the file didn't work for us but it is a pop method recommended by hosting providers then we suggest yous requite it a try.
Whether or non it works really depends on how your hosting server is configured, and then information technology might work for y'all even though information technology didn't work for us.
Brand certain you have backed up your website before proceeding with the steps.
Similar all other configuration files (i.due east. wp-config and .htaccess), the php.ini should be located in your root folder.
Connect to your website using an FTP client.
If you come across an existing file called php.ini, save it on your local computer as a fill-in. Open the file and yous should find an choice that says upload_max_filesize = 128M
. Modify the value to whatever suits yous best.
If you don't meet an existing file called php.ini, you tin can just create a new 1 in the root binder. Then, edit it and add the following line:
upload_max_filesize = 128M
Make sure to save your changes when you're done.

Fix the "upload_max_filesize directive in PHP.ini" fault for good
In this tutorial, nosotros covered iv different ways of fixing the "The uploaded file exceeds the upload_max_filesize directive in php.ini." mistake in WordPress.
If none of the methods worked for you, nosotros recommend uploading the file via FTP and so importing it to your Media Library using a plugin like Add From Server. But if that fails too, you will demand to talk to your hosting provider about having them increase the upload limit for y'all.
Do you however have any questions almost how to set the "upload_max_filesize" fault? Permit us know in the comments below.
Free guide
5 Essential Tips to Speed Up
Your WordPress Site
Reduce your loading time by even l-fourscore%
simply by following uncomplicated tips.
Download free guide
Source: https://themeisle.com/blog/the-uploaded-file-exceeds-the-upload_max_filesize-directive-in-php-ini/
0 Response to "E Uploaded File Exceeds the Upload_max_filesize Directive in Phpini"
Post a Comment