WordPress Tutorial

How to Fix The Uploaded File Exceeds the upload_max_filesize Directive in php.ini. Error in WordPress

The uploaded file exceeds the upload_max_filesize directive in php.ini. WordPress error and various ways of fixing it.

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.

the uploaded file exceeds the upload_max_filesize directive in php.ini. error in wordpress

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.Fixing the uploaded file exceeds the upload_max_filesize directive in php.ini. using .htaccessIncreasing 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.The uploaded file exceeds the upload_max_filesize directive in php.ini. error fix via wp-config.php fileOnce opened, add this line before the “Happy blogging” part:

@ini_set('upload_max_size' , '256M' );

Now save the file, refresh your browser and try again. The WordPress error should no longer occur.
Fixing the uploaded file exceeds the upload_max_filesize directive in php.ini. by increasing limits via wp-config.php file

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. Checking the current value of upload_max_filesize in WordPress Dashboard.The current maximum upload file size value can be found there, which may be useful to know when troubleshooting the issue.

Final Word

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:

  1. Increasing upload_max_filesize and other PHP values through .htaccess;
  2. Setting higher upload_max_filesize through wp-config.php file;
  3. Editing php.ini file to increase upload_max_filesize;
  4. 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!

7 Comments

Click here to post a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • The uploaded file exceeds the upload_max_filesize directive in php.ini. – that’s such a freakishly long error haha! I never thought the fixes were so simple. Thank you for this article, the first solution worked like a charm!

  • please i want to host a website and it contain a heavy folder of pdf. because it’s an e_library. so can i send the folder and you host it for me. am having difficult uploading it due to max upload file size.

  • Hi. I am still facing the issue even after trying all these methods. So far, I have tried:

    1.Increasing upload_max_filesize and other PHP values through .htaccess;
    2. Setting higher upload_max_filesize through wp-config.php file;
    3. Editing php.ini file to increase upload_max_filesize;

    However, my media upload size is still 10mb. Please tell me how to fix it. Thanks in advance!

    • Hello, Himashu

      I’m sorry to hear that the error still persists on your website. It is possible that the limitations set by your current hosting provider do not allow uploading larger files than 10MB. If the server configuration does not let you exceed this limit, it is no surprise that the above solutions did not work. You can confirm this by checking PHP info. I would also suggest getting it touch with your web hosting provider and asking them personally if the limit can be increased.

      Alternatively, you may give your WordPress website a test drive on Hostinger. The error will be a thing of the past, and you can start with a 14-day free trial! 😉

More in WordPress Tutorial
How to Perform Search and Replace in WordPress Database

Close