The uploaded file exceeds the upload_max_filesize directive in php.ini. is a WordPress error that can occur while uploading large files, images, or themes. WordPress has certain size limits depending on the platform where you’re hosting it. In turn, the PHP memory designated for running plugins and scripts also has a certain cap. Once you go beyond it, the uploaded file exceeds the upload_max_filesize directive in php.ini. error will pop up.
Most times, the error occurs on WordPress websites with lots of content. Scary and cumbersome as this WordPress error may seem, the solutions are pretty straight-forward. As you might have guessed – it involves around increasing the default limit of upload_max_filesize. Let’s dive into it and see what steps can we take to fix this WordPress error.
Option 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 using the .htaccess file. To begin, access the root directory of WordPress using a file manager or any FTP client. Then, locate the .htaccess file and edit it.Increasing upload_max_filesize value should do the trick. Add this line at the bottom of your .htaccess file to do it:
php_value upload_max_filesize 256M
Once done, try to perform the same action in WordPress which caused the error to appear and it should be gone. If it still persists, you may try increasing additional PHP limits, such as:
php_value post_max_size 256M php_value memory_limit 512M php_value max_input_time 180 php_value max_execution_time 180
Don’t forget to save your changes. If everything was done correctly, the WordPress error should no longer bother you.
You can set the PHP limits to any desired values as long as your server supports it. The maximum available limits can be located by creating a PHP info file.
Option 2: Editing the wp-config.php file
Another way to amend the uploaded file exceeds the upload_max_filesize directive in php.ini error is by editing the wp-config.php file. It is located in your main WordPress directory.Once opened, add this line before the “Happy blogging” part:
@ini_set('upload_max_size' , '256M' );
Option 3: Updating php.ini
If we look closer at the uploaded file exceeds the upload_max_filesize directive in php.ini error, we can see that it has something to do with php.ini. It is a file that holds all of PHP limit related variables. If you’re using shared web hosting by Hostinger, all limits are already set to the maximum value for user convenience. Thus it is not possible to alter php.ini. However, if you’re using VPS or a different platform, this option is fully suitable to fix the WordPress error.
To begin, navigate to /etc/php/7.0/cli/php.ini and edit the file. In our example, the PHP version is set to 7.0, which is why we’re accessing its’ directory. But it may differ depending on your hosting platform or provider.
Once you open the file, look for upload_max_filesize and increase it. You may boost a few other limitations too as shown below:
upload_max_filesize = 256MB post_max_size = 256M memory_limit = 512M max_execution_time = 180
Now save the file and close it. Then proceed with your WordPress site development and the error should no longer occur.
Option 4: Contacting customer support
If none of the above options fixed the uploaded file exceeds the upload_max_filesize directive in php.ini error, you could try contacting your web hosting support team. Explain the situation and let them know what steps you took to fix the WordPress error. You may also take a quick glance in your WordPress Dashboard › Media › Add New section. The current maximum upload file size value can be found there, which may be useful to know when troubleshooting the issue.
In this tutorial, you have learned four different ways to approach the uploaded file exceeds the upload_max_filesize directive in php.ini. error in WordPress, which are:
- Increasing upload_max_filesize and other PHP values through .htaccess;
- Setting higher upload_max_filesize through wp-config.php file;
- Editing php.ini file to increase upload_max_filesize;
- Contacting hosting provider for assistance.
If you have any questions, suggestions, or solutions to fix the uploaded file exceeds the upload_max_filesize directive in php.ini. error in WordPress, do not hesitate to comment down below!