How to Resolve the php.ini Upload_max_filesize directive exceeded error
When you attempt to upload something to your WordPress Hosting site, a notice stating that “the uploaded file exceeds the upload_max_filesize directive in php.ini” appears.
When you upload any form of file to your WordPress site, including huge images, videos, plugins, and themes, you may receive this error notice.
What Leads to a file being uploaded that is larger than the upload_max_filesize directive in php.ini
The upload_max_filesize directive in the php.ini file for one example of the uploaded file is exceeded.
Let’s begin where we left off. The maximum size of a file that can be uploaded is restricted by hosts in order to protect the resources of your server.
This upper limit is specified in megabytes by the upload_max_filesize directive.
The php.ini file, the standard server configuration file for programs using PHP, contains the upload_max_filesize directive itself.
The error message you see is referring to upload_max_filesize and php.ini, respectively.
Base of Form
It’s critical to keep in mind that WordPress Hosting site does not control this upload limit. But if you go to Media Add New on your WordPress website, you can find this restriction:
How to check the WordPress upload limit?
The default limit is 128 MB, as you can see above. This is a sizable amount and is unlikely to ever cause problems. However, many other hosts only set the default to 2 MB or 4 MB.
As a result, if you attempt to upload a file that is larger than that limit, you will see a notice stating that “the uploaded file exceeds the upload_max_filesize directive in php.ini” or something similar like “file_name exceeds the maximum upload size for this site.”
How to Correct the Upload_max_filesize directive in php.ini being exceeded by the uploaded file
You must raise the upload file size cap to resolve this issue. In other words, you must increase the upload_max_filesize directive’s value in your php.ini file.
You can accomplish this in a number of ways; the one you select will depend on your preferences and the configuration of your host.
- Consult your host’s support staff.
We’ll go over various self-help techniques, but generally speaking, you should just contact your host’s support and ask them to raise the limit for you.This is a typical request, your host’s support team should be able to do it quickly, and it shouldn’t take more than a few minutes. Your host’s support team is available to help with that.You can contact support from anywhere if you host with us and require a limit increase above the standard 128 MB limit:You can accomplish this in a number of ways; the one you select will depend on your preferences and the configuration of your host.
- Edit php.ini via cPanel
If your host uses cPanel, you ought to be able to modify your upload_max_filesize directive and php.ini file from the cPanel dashboard.
Find the MultiPHP INI Editor first:
The cPanel’s MultiPHP INI Editor
Next, select your WordPress Hosting website from the drop-down menu. After that, you can change the site’s upload_max_filesize directive:
Run your Node.js, Python, Go, PHP, Ruby, Java, and Scala applications in three simple steps (or nearly anything else if you use your own custom Dockerfiles)!
Modifying the cPanel upload_max_filesize directive
If necessary, increase the value.
- Using FTP, create or modify php.ini
The php.ini file regulates how your server handles PHP applications, as you learned above.
Unfortunately, you might or might not be able to use php.ini files depending on the limitations imposed by your server. For this reason, using.htaccess (which we’ll explore in the following section) can occasionally be a more dependable strategy.
To find out if you can utilize php.ini at your host, you can try this out first.
Go to the root folder of your website and connect to your server using FTP to begin going.
If there is already a php.ini file present in the root folder, you can edit it. If not, make a fresh file called php.ini:
How to make a fresh php.ini file
Add or change the following code fragment:
Having issues with downtime and WordPress Hosting?
- If you made a new file, paste the code fragment in there and change the numbers to your specifications.
- If you’re modifying an existing file, look for the identical directives there and change the numbers to fit your requirements.
upload_max_filesize = 12M
post_max_size = 13M
memory_limit = 15M
The php.ini file being updated with the code
In order for the modifications above to take effect, certain hosts may also require you to add the suPHP directive to your site’s.htaccess file.
You may also use PHP to alter your.htaccess file and add the following code towards the start of the file to accomplish this:
IfModule mod_suphp.
suPHP_ConfigPath /home/yourusername/public_html
/IfModule;
Make sure to substitute yourusername for the site’s actual file path.
- By editing.htaccess, increase upload_max_filesize value.If using the aforementioned procedures to directly create or update the php.ini file didn’t succeed, you may alternatively try to change the upload_max_filesize directive by modifying the.htaccess file for your website.To begin, establish an FTP connection to your website and update the.htaccess file in the root directory of your website.
After that, incorporate the following code fragment, being sure to modify the values to suit your requirements:
php_value upload_max_filesize 12M
php_value post_max_size 13M
php_value memory_limit 15M
To do this, you can also edit your .htaccess file via PHP and add the following code near the top of the file:
IfModule mod_suphp.c>
suPHP_ConfigPath /home/yourusername/public_html
/IfModule
Make sure to replace