If File Upload Php Exceeds Php.ini Upload_max_filesize Stack

I sympathize the near frustrating issue on WordPress is "the uploaded file exceeds the upload_max_filesize directive in php.ini."

Information technology happens when y'all try to:

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

Did you know?

The bulk of the guides available on the net don't work to set the issue of the upload max filesize since they endeavor to increment the limit of upload_max_filesize only, but the chemical element of post_max_size is also critical to solve information technology. Keep reading to larn more.

But don't worry,  I'll testify you the screenshots of each footstep for effortless resolving the result.

Excited?

Let'southward first start with what causes the problems.

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 ownership techniques, particularly with the word "unlimited."

Unlimited Hosting

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

Just the reality is the opposite.

They all have limitations commonly 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 grand visits a month, imposing no threats to their valuable resources. To save from the rest, they put restrictions on the server, for example, non 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 let you to upload more than 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 exist wondering where the default setting is saved? Generally, information technology 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, just it's not true. WordPress has zilch to practice with php.ini. Information technology doesn't come with the default WordPress installation.

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

Complete WordPress Unzip

Rather it'southward the limitation imposed by your hosting in the php.ini or like alternatives that command the server resource.

Let's dive into solving this trouble.

6 Means to Fix the uploaded file exceeds the upload_max_filesize

1. Your Hosting Back up

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

Keep in heed 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

Roll down a lilliputian; you'll come to know about shocking stories about Bluehost.

Review About BlueHost

It doesn't hateful nosotros're against Bluehost personally, merely the same is the case with Hostgator.

Hostgator Bad Review

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

At One Smart Sheep, we understand that clients are the nearly valuable avails. Their problems are solved on an immediate footing.

What does One Smart Sheep practice?

We build globe-form websites from the ground up and provide ultra-fast hosting, maintenance, and defended managers for outstanding support over telephone, email, and live conversation, 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 document to backup.

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

PHP INI Editor

When you click on information technology, you tin can select whatever website from the driblet menu to increase the limit.

Edit The Php Ini File In Cpanel

You'll see many PHP directives. In society to increase the upload_max_filesize, delight increase the limits of two directives:

  • post_max_size: 5000M
  • upload_max_filesize: 5000M

Enter whatever value. Here M stands for MegaBytes. If you desire to have a limit of 50GB, yous need to blazon 50000M.

You lot tin 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 take to increase for post_max_filesize too in club to work.

Did you know? When you brand changes in the MULTI PHP Editor,  cPanel creates a file php.ini in your root directory automatically. Information technology runs equally:

; cPanel-generated php ini directives, do not edit

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

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

; For more than data, read our documentation (https://get.cpanel.internet/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

Exercise you know? Y'all can increase the upload_max_fileize with the help of .htaccess easily.

First, you need to detect 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 unmarried website, navigate to public_html, simply you ain multiple domains, yous'll meet unlike folders on the left side of File Manager.

Htaccess File

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

Edit The .htaccess File In Cpanel

Y'all'll become a warning to make a backup before making any changes, just don't worry, over again hit Edit.

Edit

Now paste the below lawmaking after the line "# Whatsoever 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 Salvage Changes.

Save CHanges The .htaccess File Edit

Done!

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

To Create .htaccess File

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

# Begin WordPress

RewriteEngine On

RewriteRule .* – [Due east=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 mode I explained above.

4. Editing wp-config.php File

In some cases, no method might work for you.

It'south pretty simple.

Over again become back to cPanel > File Director > the root directory of your website.

Observe 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 equally 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 selection of Multi PHP INI Editor; yous need to edit php.ini. If this php.ini doesn't exist, y'all can create your ain.

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 vii.1

Download default php.ini vii.2

Download default php.ini vii.3

You might be thinking about how to cheque the PHP version? Navigate to the Software in cPanel and click MultiPHP Managing director.

Multi PHP Manager

Here y'all can see the current version of your website.

PHP Version Check

In my case, I'g running PHP version seven.3. So I'll download the default file of php.ini for 7.3.

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

PHP File Name Change

Information technology doesn't work until you lot check File proper noun extensions from the View section in Windows x.

Windows 10 File Extension

In Mac, yous tin can detect information technology in Finder Preferences.

In Mac

Now go back to cPanel home and notice File Manager.

File Manager In CPanel 1

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

Upload The Php.ini

Before nosotros upload the php.ini, let'south edit information technology for upload_max_filesize and post_max_filesize.

Increase Limit Of Upload Max Filesize In Php.ini

The default is 2M, but yous can change information technology to whatsoever value you lot desire. I choose 50000M, exactly 50GB. It'southward not washed nonetheless. 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 hither is the final version of php.ini.

Php.ini In The Root Directory

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

The employ 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 club to admission FTP, download Filezilla, the near famous client to communicate with your site over FTP.

FileZilla Download

I always use Google Sheet to store my confidential data.

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, countersign, 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 binder by default.

Filezilla Connected

Start of all, I'll edit the .htaccess. It'southward 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 earlier #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 printing Ctrl+South 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 "End 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 beneath code before Happy Blogging.

Wp Config.php In FTP

Salve changes.

Save The Changes

Close the Window. Filezilla will enquire again for permission.

FTP Wp Config.php Changes

Check "Stop editing and delete local file" and click Yes.

Things To Practise Afterwards Making Changes…

  • If you're using VPS hosting.

If you're using a VPS hosting similar 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 hitting enter.

Reboot The VPS

  • If yous're using cPanel hosting.

cPanel hosting doesn't let you to restart your server. The just option is to clear your enshroud.

Sign in to your WordPress and purge all enshroud.

Purge All

  • If y'all're using Cloudflare

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

Cloudflare Cashing

Final Thoughts

I'one thousand 100% certain your problem will exist solved upon trying all the means we have mentioned. As I depicted in the introduction, the error isn't fixed until you increase 2 values: upload_max_filesize and post_max_size.

In a nutshell, if you're a cPanel user, the all-time way is to use a Multi PHP Editor. If yous employ a VPS hosting similar DigitalOcean, then .htaccess and wp-config.php are the all-time ways to solve information technology.

Allow united states of america know which method worked for y'all?

lewistherefecance.blogspot.com

Source: https://onesmartsheep.com/web-design/fix-the-uploaded-file-exceeds-the-upload_max_filesize/

0 Response to "If File Upload Php Exceeds Php.ini Upload_max_filesize Stack"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel