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 to 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.
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.
- 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
- 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.
- Click “Select PHP Version” under the SOFTWARE section. In some web-hosting’s it could be “PHP Manager” or “MULTIPHP INI Editor” etc.
- Click the “Options”.
- You can see 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.
- 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.
02. How To Change From “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.
- Create a Notepad file on your desktop.
- Paste these three lines:
post_max_size = 13M
memory_limit = 128M
- You can set the size of your own choice.
- 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.
- 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” .
- Once you open “.htaccess” file paste these lines at the top. You can the set size of your choice.
php_value post_max_size 13M
php_value memory_limit 128M
- Once you add these lines save your “.htaccess” file.