6 Ways to Fix the Uploaded File Exceeds the Upload_Max_Filesize

Blog Web Design
Author
Zee Ahmed
President/CEO
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

I understand the most frustrating issue on WordPress is “the uploaded file exceeds the upload_max_filesize directive in php.ini.”

It happens when you try to:

  • Upload a huge image or video file on your WordPress.
  • Install a titanic size plugin or theme, especially when it has a lot of features.
  • Or any file that exceeds your upload max filesize.

Did you know?

The majority of the guides available on the internet don’t work to fix the issue of the upload max filesize since they try to increase the limit of upload_max_filesize only, but the element of post_max_size is also critical to solve it. Keep reading to learn more.

But don’t worry,  I’ll show you the screenshots of each step for effortless resolving the issue.

Excited?

Let’s first start with what causes the issues.

Reasons Behind the Error “the uploaded file exceeds the upload_max_filesize directive in php.ini.”

Well-reputed companies try to persuade consumers with different buying techniques, especially with the word “unlimited.”

Unlimited Hosting

You’ll find plenty of hosting companies claiming to be unlimited in terms of storage and bandwidth.

But the reality is the opposite.

They all have limitations usually depicted in the fair-usage policy or terms and conditions. These policies exist for a reason — preserving the hosting’s resources.

They know 90% of the websites will not get more than 1000 visits a month, imposing no threats to their valuable resources. To save from the rest, they put restrictions on the server, for example, not allowing to upload 20MB or bigger file size. This restriction saves a lot of valuable resources.

Namecheap Maximum Upload Size Limit

Let’s take an example of Namecheap, which doesn’t allow you to upload more than 300,000 files, aka inodes, in its shared hosting plan, and the maximum upload size limit is just 50MB.

Inodoes Limit

The same is the case with the upload max file size limit.

You might be wondering where the default setting is saved? Generally, it exists in the php.ini file.

The default php.ini looks like this:

Some people blame WordPress for the lower limit of max upload size, but it’s not true. WordPress has nothing to do with php.ini. It doesn’t come with the default WordPress installation.

Here are all the files after unzipping the WordPress file downloaded from the official WordPress website — no php.ini is available.

Complete WordPress Unzip

Rather it’s the limitation imposed by your hosting in the php.ini or similar alternatives that control the server resources.

Let’s dive into solving this problem.

6 Ways to Fix the uploaded file exceeds the upload_max_filesize

1. Your Hosting Support

It’s obvious, I know. 😁 But some people hesitate to contact their hosting providers; otherwise, it’s the fastest way to fix the issue.

Keep in mind that the support of all hosting companies is not the same. For example, the industry-leading hosting provider Bluehost is one of the worst hosting companies on the planet.

Bluehost Bad Reviews On Trustpilot

Scroll down a little; you’ll come to know about shocking stories about Bluehost.

Review About BlueHost

It doesn’t mean we’re against Bluehost personally, but the same is the case with Hostgator.

Hostgator Bad Review

The takeaway is to get a great hosting company that has exceptional support.

At One Smart Sheep, we understand that clients are the most valuable assets. Their issues are solved on an immediate basis.

What does One Smart Sheep do?

We build world-class websites from the ground up and provide ultra-fast hosting, maintenance, and dedicated managers for outstanding support over phone, email, and live chat, including everything in $49/month.

2. Use MultiPHP INI Editor in cPanel

cPanel makes life easier for people to manage their websites at their fingertips. It provides dozens of tools from installing an SSL certificate to backup.

It has a separate tool to increase the max upload size limit known as MultiPHP INI Editor.

PHP INI Editor

When you click on it, you can select any website from the drop menu to increase the limit.

Edit The Php Ini File In Cpanel

You’ll see many PHP directives. In order to increase the upload_max_filesize, please increase the limits of two directives:

  • post_max_size: 5000M
  • upload_max_filesize: 5000M

Enter any value. Here M stands for MegaBytes. If you want to have a limit of 50GB, you need to type 50000M.

You can see the limit in the library.

50GB Limit For Max Upload Size

Note: Most people make mistakes to increase only the value of upload_max_filesize, but you have to increase for post_max_filesize as well in order to work.

Did you know? When you make changes in the MULTI PHP Editor,  cPanel creates a file php.ini in your root directory automatically. It runs as:

; cPanel-generated php ini directives, do not edit

; Manual editing of this file may result in unexpected behavior.

; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)

; For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)

display_errors = Off

max_execution_time = 90

max_input_time = -1

max_input_vars = 1000

memory_limit = 128M

post_max_size = 50000M

session.gc_maxlifetime = 1440

session.save_path = “/var/cpanel/php/sessions/ea-php73”

upload_max_filesize = 50000M

zlib.output_compression = Off

3. Increase upload_max_filesize value by editing .htaccess 

Do you know? You can increase the upload_max_fileize with the help of .htaccess easily.

First, you need to find where .htaccess is located basically in the root directory of your website.

If you’re using cPanel, go to File Manager. If you own a single website, navigate to public_html, but you own multiple domains, you’ll see different folders on the left side of File Manager.

Htaccess File

Right-click on the .htaccess file and hit Edit.

Edit The .htaccess File In Cpanel

You’ll get a warning to make a backup before making any changes, but don’t worry, again hit Edit.

Edit

Now paste the below code after the line “# Any changes to the directives between these markers will be overwritten.”

php_value upload_max_filesize 5000M

php_value post_max_size 5000M

php_value memory_limit 256M

php_value max_execution_time 300

php_value max_input_time 300

Increase Limit

And hit Save Changes.

Save CHanges The .htaccess File Edit

Done!

Note: In the new installation of WordPress, you might not see .htaccess. In order to create it, either you have to make changes to your permalink or manually upload the default .htaccess file.

To Create .htaccess File

In order to manually upload it, firstly download the default .htaccess file. The default .htaccess runs as:

# BEGIN WordPress

RewriteEngine On

RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteBase /

RewriteRule ^index.php$ – [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

# END WordPress

And upload in the root directory of your website.

Upload In The Root Directory

And edit it the way I explained above.

4. Editing wp-config.php File

In some cases, no method might work for you.

It’s pretty simple.

Again go back to cPanel > File Manager > the root directory of your website.

Find wp-config.php.

Wp Config Location In CPanel

Right-click to edit.

Edit The Wp Config.php By Right Clicking

Now paste the below code as shown in the screenshot below.

@ini_set( ‘upload_max_filesize’ , ‘5000M’ );

@ini_set( ‘post_max_size’, ‘5000M’);

@ini_set( ‘memory_limit’, ‘256M’ );

@ini_set( ‘max_execution_time’, ‘300’ );

@ini_set( ‘max_input_time’, ‘300’ );

Wordpress Wp Config Increase Limit Of Upload Max Size

Don’t forget to save changes.

Save Changes For Wp Config

 

5. Create or Edit php.ini via cPanel

Some hosting might not have the option of Multi PHP INI Editor; you need to edit php.ini. If this php.ini doesn’t exist, you can create your own.

Download the default version of php.ini as per your PHP version.

Download default php.ini 5.4

Download default php.ini 5.5

Download default php.ini 5.6

Download default php.ini 7.0

Download default php.ini 7.1

Download default php.ini 7.2

Download default php.ini 7.3

You might be thinking about how to check the PHP version? Navigate to the Software in cPanel and click MultiPHP Manager.

Multi PHP Manager

Here you can see the current version of your website.

PHP Version Check

In my case, I’m running PHP version 7.3. So I’ll download the default file of php.ini for 7.3.

The issue is that it has a filename that needs to be changed from php-72-ini.txt to php.ini.

PHP File Name Change

It doesn’t work until you check File name extensions from the View section in Windows 10.

Windows 10 File Extension

In Mac, you can find it in Finder Preferences.

In Mac

Now go back to cPanel home and find File Manager.

File Manager In CPanel 1

Navigate to your website name shown as a folder name on the left side and click upload.

Upload The Php.ini

Before we upload the php.ini, let’s edit it for upload_max_filesize and post_max_filesize.

Increase Limit Of Upload Max Filesize In Php.ini

The default is 2M, but you can change it to any value you desire. I choose 50000M, exactly 50GB. It’s not done yet. Find another value post_max_size.

Post Max Size

Now it’s time to save changes.

Save Changes

Now upload the php.ini file into the root directory of your WordPress website.

Upload The Php.ini File

And here is the final version of php.ini.

Php.ini In The Root Directory

6. Use FTP to Edit wp-config.php and .htaccess

The use of cPanel is declining thanks to cloud computing that enables you to manage your website at insanely cheap rates.

CPanel Low Trend

DigitalOcean, Vultr, Linode, AWS, Microsoft Azure, and Google Cloud Platform are among the best cloud hosting on the planet.

If you make a site on it, you’re generally given access to FTP. In order to access FTP, download Filezilla, the most famous client to communicate with your site over FTP.

FileZilla Download

I always use Google Sheet to store my confidential information.

DigitalOcean Confidential

So, I’ll use the above information to connect with my FTP server. I put the VPS server IP into the host box, username as root, password, and left port as empty.

And the important thing, I put /var/www/html into the remote site box as WordPress is installed in this folder by default.

Filezilla Connected

First of all, I’ll edit the .htaccess. It’s simple. Right-click .htaccess and click edit.

Edit The .htaccess File In FTP

It asks for a default code editor. I use Microsoft Visual Studio Code. The default location is

“C:UsersYOURUSERNAMEAppDataLocalProgramsMicrosoft VS CodeCode.exe”

Don’t forget to replace your Windows username.

Now copy the below code and paste before #END WordPress.

Htaccess In FTP

php_value upload_max_filesize 5000M

php_value post_max_size 5000M

php_value memory_limit 256M

php_value max_execution_time 300

php_value max_input_time 300

And now press Ctrl+S in order to save it.

Now close the Visual Code window. Instantly, FileZilla will ask for permission to delete the local file and save it to your server.

Htaccess File Has Changed

Enable “Finish editing and delete local file” and click Yes.

If it doesn’t work, use the wp-config edit.

Wp Config.php Edit In FTP

And paste the below code before Happy Blogging.

Wp Config.php In FTP

Save changes.

Save The Changes

Close the Window. Filezilla will ask again for permission.

FTP Wp Config.php Changes

Check “Finish editing and delete local file” and click Yes.

Things To Do After Making Changes…

  • If you’re using VPS hosting.

If you’re using a VPS hosting like DigitalOcean, Vultr, or Linode, don’t forget to restart your server.

It’s straightforward.

Sign in to your platform and run Console.

Console Digital Ocean

Enter your username and password and type reboot, and hit enter.

Reboot The VPS

  • If you’re using cPanel hosting.

cPanel hosting doesn’t allow you to restart your server. The only option is to clear your cache.

Sign in to your WordPress and purge all cache.

Purge All

  • If you’re using Cloudflare

If you use Cloudflare, you should clear your cache. It’s effortless to perform. Sign in to your Cloudflare account, navigate to Caching, click Configuration, and hit Purge Everything.

Cloudflare Cashing

Final Thoughts

I’m 100% sure your problem will be solved upon trying all the ways we have mentioned. As I depicted in the introduction, the error isn’t fixed until you increase two values: upload_max_filesize and post_max_size.

In a nutshell, if you’re a cPanel user, the best way is to use a Multi PHP Editor. If you use a VPS hosting like DigitalOcean, then .htaccess and wp-config.php are the best ways to solve it.

Let us know which method worked for you?