Mostly there is a limit set to the PHP memory by web hosting providers to run applications and scripts. An error “the uploaded file exceeds the upload_max_filesize directivein php.ini” occurs on your WordPress website when the file you upload exceeds the limits set by the web server.
Though this error may seem to be scary, it has straight-forward solutions. In this tutorial, you will learn about fixing the error by increasing the default limit of upload_max_filesize using a few methods.
Methods to Fix the upload_max_filesize Error
Method 1. Edit the .htaccess File
Method 2. Edit the wp-config.php File
Method 3. Update php.ini
Method 4. Edit php.ini File Through cPanel
Method 5. Contact MilesWeb’s Customer Support
Method 1. Edit the .htaccess File
The quick method to fix the error “the uploaded file exceeds the upload_max_filesize directive in php.ini” is to increase your PHP resource limits by modifying the .htaccess file. It can be done as below:
- Login to your cPanel and go to Files->File Manager.
- Find the .htaccess file and right-click on it to Edit.
- A confirmation window for editing the file will pop-up, click on Edit again.
- Include this line below the file:
php_value upload_max_filesize 256M
- Now, Save the changes.
- In this way, you can increase the upload_max_filesize value that will automatically fix the error.
- Upload your file again and still the error occurs, increase the additional PHP limits by including the below 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
- Modify the PHP limits to your preferred values until your web hosting provider supports it. Moreover, find the maximum available limits by checking the PHP info of your website.
Method 2. Edit the wp-config.php File
- The second method to get rid of this error is by modifying the wp-config.php file located in your root directory.
- Just log in to the cPanel, go to public_html and search for the wp_config. php file. Right-click on the file and click on Edit.
- A confirmation window for editing the file will pop-up, click on Edit again.
- Include the below line before the “That’s all, stop editing! Happy publishing” line:
@ini_set('upload_max_size' , '256M' );
- Then Save Changes to the file, refresh your web browser and try to upload it again.
Method 3. Update php.ini
When you keenly check uploaded file exceeds the upload_max_filesize directive in php.ini error message, you can assume that there is something related to php.ini, a file that comprises of all of the PHP related variables.
On a shared server of MilesWeb, you can modify it by altering php.ini.
- In terms of VPS or a different platform, try to update php.ini to fix the error.
- Go to your php.ini file, right-click on it and click on Edit it. In case you don’t find it, ask for help from your hosting providers.
- Find the upload_max_filesize and increase it by modifying its number. You can also increase a few other limitations, as below:
upload_max_filesize = 256M post_max_size = 256M memory_limit = 512M max_execution_time = 180
- Now, Save the file and the error should no longer exist.
Method 4. Edit php.ini File Through cPanel
If your web host has offered you cPanel, you can easily edit the php.ini file and upload_max_filesize directive via the cPanel dashboard.
- Go to MultiPHP INI Editor under Software section.
- Select your WordPress website from the dropdown and edit the upload_max_filesize directive as below and click on Apply:
You can increase the value based on your requirements.
Method 5. Contact MilesWeb’s Customer Support
If none of above options helps in fixing the error and you are a customer of MilesWeb, contact their customer support team.
You can explain them the situation and the steps you followed to fix the error. They will resolve the problem for you.
You can contact MilesWeb’s support team at any time. There are two contact options: email and live chat.
Conclusion
Hopefully, you will able to resolve the upload_max_filesize error with the above methods.
Also Read