Connect with us

How To Fix The uploaded file exceeds the upload_maximum_filesize directive in php.ini

How To Fix The uploaded file exceeds the upload_maximum_filesize

Blogging

How To Fix The uploaded file exceeds the upload_maximum_filesize directive in php.ini

(Last Updated On: October 20, 2022)

Are you getting the error, “The uploaded file exceeds the upload_maximum_filesize directive in php.ini” while uploading a WordPress theme, image, video, text file etc? Don’t worry you are in the right place, we will guide you step-by-step on how to fix this error by changing the “upload_max_filesize”.

The error comes because the size of the file or theme that you want to upload is larger than the maximum file upload limit set in the “php.ini” file. In general, most of the web hosting service providers set the default “upload_max_filesize” to 2MB. Once you increase the upload size you will get rid of this error.

What is “php.ini” file? The “php.ini” file is the default configuration file for all those running applications that require PHP such as WordPress, Joomla, Magento, Drupal etc. This file is used to control variables such as upload sizes, memory limit, post size, file timeouts, resource limits, etc.

The “php.ini” file is located in your website’s root directory which is called “Public_Html”. If your website is hosted on shared hosting you will not see “php.ini” file because in the shared web hosting its access is restricted, but don’t worry you can change the “upload_max_filesize” from your cPanel PHP Manager, which is much easier and safe. You won’t be required to find and edit the “php.ini” file.

In this post following topics will be covered step-by-step:
  • How To Change “upload_maximum_filesize” From PHP Manager
  • How To Change “upload_maximum_filesize” From “php.ini” File
  • How To Change “upload_maximum_filesize” From “.htaccess” File

 

01. How To Change From PHP Manager

This is the recommended, safest and easiest way to change the “upload_maximum_filesize” without editing the “php.ini” file or “.htaccess” file. If this works for you then don’t go to other two methods.
  • Login to your cPanel via the URL provided to you by your web hosting provider. It will be similar to “https://www.cpanel.xyz.com”. Instead of “xyz.com” there will be your website domain.
  • Enter your Username & Password.
  • Click “Log in” to access your cPanel.
How To Fix Uploaded File Exceeds The Upload_Maximum_Filesize Directive In PHP.ini 1
  • Click “Select PHP Version” under the SOFTWARE section. In some web-hosting’s it could be “PHP Manager” or “MULTIPHP INI Editor” etc.
How To Fix Uploaded File Exceeds The Upload_Maximum_Filesize Directive In PHP.ini 2
  • Click the “Options”.
The uploaded file exceeds the upload_maximum_filesize directive in php.ini 3
  • There are lot of options here like “max-execution_time”, “memory_limit”, “post-max-size” etc. Scroll down to “upload_max_filesize”.
  • You can see here that the default upload size is 2MB. It means that if your theme or file is larger than 2MB it will not allow to upload.
The uploaded file exceeds the upload_maximum_filesize directive in php.ini 4
  • Click the size dropdown and choose the maximum upload file size that you want to set.
  • Here we have set the “upload_max_filesize” to 16MB.
  • Once you save settings go back to your website admin section and check whether your files are uploading or not.
The uploaded file exceeds the upload_maximum_filesize directive in php.ini 5

 

02. How To Change From “php.ini” File

As we have mentioned above that if your website is hosted on shared web hosting you won’t see the “php.ini” file, but in case your web hosting provider gives access to the “php.ini” file you can change the maximum upload filesize. Before you edit take the backup of “php.ini” file.
  • The “php.ini” is located in the “Public_Html” directory.
  • Open “php.ini” file and search for “upload_max_filesize” variable.
  • Change the size and save your “php.ini” file.
  • Here “M” shows MB. If you want to change the size only change the digit not “M” like 16M.
How To Fix Uploaded File Exceeds The Upload_Maximum_Filesize Directive In PHP.ini 6
In case if your web hosting does not give access to “php.ini” file you can create a “php.ini” file in your computer and upload at your “Public_Html” directory via FTP application such as FileZilla Or upload directly from you Control Panel account.
  • Create a Notepad file on your desktop.
  • Paste these three lines:
upload_max_filesize = 16M
post_max_size = 13M
memory_limit = 128M
  • You can set the size of your own choice.
How To Fix Uploaded File Exceeds The Upload_Maximum_Filesize Directive In PHP.ini 7
  • Now save this file as .ini”.
  • In the “File name:” type “php.ini”.
  • In the “Save as type” choose “All Files (“.”)”.
  • Now upload this file to your “Public_Html” directory via any FTP application such as FileZilla.
How To Fix Uploaded File Exceeds The Upload_Maximum_Filesize Directive In PHP.ini 8

 

03. How To Change From “.htaccess”

If “php.ini” file is restricted on your web hosting you can change the “upload_max_filesize” from “.htaccess” file. The htaccess stands for “hypertext access”. Like “php.ini” it is also very powerful and sensitive configuration file. Before you modify this file take a backup.
  • It is located in the “Public_Html” directory. The “.htaccess” is a hidden file, so in order to edit make it visible by enabling “Show Hidden Files (dotfiles)” option in “Settings” .
How To Fix Uploaded File Exceeds The Upload_Maximum_Filesize Directive In PHP.ini 9
  • Once you open “.htaccess” file paste these lines at the top. You can the set size of your choice.
php_value upload_max_filesize 16M
php_value post_max_size 13M
php_value memory_limit 128M
  • After adding these lines save your “.htaccess” file.
How To Fix Uploaded File Exceeds The Upload_Maximum_Filesize Directive In PHP.ini 10

 

So these were the three methods to fix the error, “The uploaded file exceeds the upload_max_filesize directive in php.ini”, hope they will help you. If you like this post then don’t forget to share with other people. Share your feedback in the comments section below.

 

Cheap Website Themes

 

Also Read:

 

Meer Basit is the founder of Meer’s World. He’s been running the show since launching the blog back in 2018. By background he is a computer scientist. Primarily, he creates content around blogging (WordPress, Blogger, Tumblr), SEO, affiliate programs, earn-online, reviews, eCommerce, & technology. He has got years of professional experience in web programming, computer programming, databases, data warehousing, & transcription. In general, he likes traveling, gardening, watching movies, is a passionate cricketer, creative writer, and a GSD lover.

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

More in Blogging

To Top