Most hosting providers set limits to the PHP memory designated for running applications and scripts. The uploaded file exceeds the upload_max_filesize directive in php.ini is an error that occurs on your WordPress site when you upload a file that exceeds the limitations set by your webserver.
As scary as this error may seem, the solutions are pretty straight-forward. In this tutorial, you will learn how to fix the error by increasing the default limit of upload_max_filesize through a few methods.
How to Fix the upload_max_filesize Error
The solution, as you might have guessed, involves increasing the default limit of upload_max_filesize. Let’s dive into it and see what steps we can take to fix this WordPress error.
Method 1. Editing the .htaccess File
The quickest fix for the uploaded file exceeds the upload_max_filesize directive in php.ini error is increasing your PHP resource limits by tweaking the .htaccess file. Here’s how to do it:
- Login to hPanel and navigate to File Manager under the Files section.
- Locate the .htaccess file and right-click to Edit.
- Add the following line at the bottom of the file:
php_value upload_max_filesize 256M
and Save the changes.
That’s it! Increasing the upload_max_filesize value should automatically fix the error.
Try uploading your file again and if the error persists, Increase additional PHP limits by adding these lines into the .htaccess file :
php_value post_max_size 256M php_value memory_limit 512M php_value max_input_time 180 php_value max_execution_time 180
Method 2. Editing the wp-config.php File
Another way to get rid of the uploaded file exceeds the upload_max_filesize directive in php.ini error is by tweaking the wp-config.php file located in your root directory.
All you need to do is log in to the hPanel and access public_html to edit the wp_config. php file. Add the following line before the “That’s all, stop editing! Happy publishing” line:
@ini_set('upload_max_size' , '256M' );
Now Save the file, refresh your web browser, and try uploading again!
Method 3. Updating php.ini to Fix the upload_max_filesize Error
If you look closer at the uploaded file exceeds the upload_max_filesize directive in php.ini error message, we can safely assume that it has something to do with php.ini, a file that holds all of the PHP related variables.
However, you can always modify your PHP settings through the PHP Configuration tool on hPanel if you wish.
If you’re using VPS or a different platform, you can try updating php.ini to fix the error, here’s what you need to do:
- Navigate to your php.ini file and edit it. If you can’t find it, ask assistance from your hosting providers.
- Locate the upload_max_filesize and increase it by changing its number. You can also boost a few other limitations, as shown below:
- Save the file, and that’s it, the error should no longer occur.
upload_max_filesize = 256M post_max_size = 256M memory_limit = 512M max_execution_time = 180
Method 4. Making Changes to PHP Configurations on hPanel
Log in to hPanel and head to PHP Configuration under Advanced. Then, switch to the PHP Options menu and scroll down to find upload_max_file row and make changes as needed
Method 5. Contacting Customer Support to Fix the upload_max_filesize Error
If none of the options above fixed the error, try contacting your web hosting support team.
Explain the situation and let them know what steps you took to fix the WordPress error, and hopefully, they’ll resolve the problem for you.
In this tutorial, you have learned five different ways to fix the uploaded file exceeds the upload_max_filesize directive in php.ini error in WordPress. Here’s a quick recap:
- Increasing upload_max_filesize and other PHP values through the .htaccess file
- Setting higher upload_max_filesize through the wp-config.php file
- Editing php.ini file to increase upload_max_filesize
- Editing and adjusting PHP configurations through the PHP Configuration feature on hPanel
- Contacting your hosting providers for assistance
Easy, right? If you have any questions or suggestions, don’t hesitate to comment down below!