Know how to fix How to Fix the uploaded file exceeds the upload_max_filesize directive in php.ini Error?
PHP memory limits are typically set by hosting providers for scripts and applications.
If you upload a file larger than the limits set by your webserver, your WordPress site will display an error message: php.ini’s upload_max_filesize directive exceeds the upload size limit.
It may seem scary, but the solutions to this problem are quite simple. This tutorial will teach you how to increase the default upload_max_filesize limit to fix the error.
When you upload files that are larger than the server-side setting, the uploaded file exceeds the upload max filesize directive in php.ini. File size limitations are frequently used by web providers and administrators to save space while maintaining website responsiveness.
Table of Contents
How to Fix the uploaded file exceeds the upload_max_filesize directive in php.ini Error in 5 Easy Ways?
You might guess that the solution is to increase upload_max_filesize’s default limit. We should take steps to fix this WordPress error, so let’s get started.
Method 1. Changing the .htaccess file
You can increase your PHP resource limits by tweaking your .htaccess file to resolve the upload_max_filesize that exceeds the php.ini directive error as quickly as possible.
Follow these steps:
- Visit the Files section within hPanel and click on File Manager.
- Find and right-click the .htaccess file.
- At the bottom, insert the following snippet:
php_value upload_max_filesize 12M
php_value post_max_size 13M
php_value memory_limit 15M
There you have it! By increasing upload_max_filesize, the error should be resolved automatically.
If your web hosting provider supports it, you can adjust the PHP limits accordingly. Check the PHP details of your website to find out what the maximum available limits are.
Method 2. Editing the WordPress configuration file
In addition, you can resolve the upload_max_filesize directive that exceeds the upload_max_filesize in php.ini error by tweaking the wp-config.php file in the root directory of your WordPress installation.
For editing the wp_config, you simply need to access public_html from the hPanel. The PHP file can then be edited.
You need to insert the following line before the “That’s all, stop editing! Happy publishing” line:
@ini_set(‘upload_max_size’ , ‘256M’ );
Try saving, refreshing, and uploading it again after you save the file!
Method 3. Updating php.ini to Fix the upload_max_filesize Error
If you look closely at the error message that indicates the uploaded file exceeds the upload_max_filesize directive, you may be able to figure out that it’s related to the php.ini file.
Log into your hosting provider. The PHP Configuration tool on the hPanel provides access to modify PHP settings if needed.
Here’s what you need to do if you’re using a VPS or another platform to fix the error:
- Navigate to your php.ini file and make changes. Ask your hosting provider for help if you cannot find the file.
- By changing the upload_max_filesize number, you can increase the maximum file size. Other limitations can also be increased, as shown below:
upload_max_filesize = 256M
post_max_size = 256M
memory_limit = 512M
max_execution_time = 180
- Save the file, and you should no longer see the error.
Method 4. The upload_max_filesize error can be fixed by contacting Hosting customer support
Try contacting your web hosting support team if none of the options above work.
If you explain the situation and explain what steps you took to resolve the WordPress error, they may be able to resolve the matter for you.
It is not commonplace for hosting firms to limit the settings that clients can change themselves. Some of the actions indicated in the preceding steps may be inaccessible depending on your hosting provider.
In such circumstances, you may need to contact your host’s support services. This type of setting is performed by the majority of hosts as part of their usual service.
What causes the uploaded file to exceed the upload_max_filesize directive in php.ini?
Let’s go back to the beginning. Your host sets a limit on the size of an uploaded file in order to preserve the server’s resources.
The upload_max_filesize directive defines this maximum, in megabytes. For applications that require PHP, the upload_max_filesize directive resides in the php.ini file.
There are two things you need to know:
upload_max_filesize and php.ini. The error message refers to those two things.
The upload limit isn’t a WordPress setting, so keep that in mind. The limitation can, however, be seen on your WordPress site by going to Media → Add New.
How to check upload limit in WordPress?
Mosting hosting provier’s default limit of 128 MB is quite large and unlikely to cause trouble. As you can see above, it is quite large and unlikely to cause issues. There are some hosts that set the default as small as 2MB or 4MB.
You will see the message “the uploaded file exceeded the maximum size allowed in php.ini”, or something along the lines of “file_name exceeded the maximum upload size for this site.” if you upload a file larger than the limit.
Conclusion: Fix the upload_max_filesize Error in WordPress
This tutorial has shown you how to solve the upload_max_filesize directive exceeds the upload limit in WordPress using five different methods.
- The .htaccess file can be used to increase upload_max_filesize and other PHP values.
- In the wp-config.php file, you can increase upload_max_filesize.
- To increase upload_max_filesize, edit the php.ini file.
- The PHP Configuration feature in hPanel allows you to edit and adjust PHP configurations.
Regardless of the method used, you may now determine the maximum file size when uploading files to your website by following these simple procedures.