The Upload File Exceeds the Upload_max_filesize Directive in Phpini

Themeisle content is free. When you purchase through referral links on our site, we earn a commission. Acquire More

Did you but try to upload a file to your WordPress site merely to be met by an error message maxim "the uploaded file exceeds the upload_max_filesize directive in PHP.ini"?

The error occurs when you are trying to upload a large file which tin can be an image, plugin, theme, or video. If the file size of the upload exceeds the maximum upload size configuration on your hosting server, you'll run into this error message.

The fix? Edit your server's configuration settings to increase the maximum upload filesize.

In this article, we are going to assistance you resolve this result past extending the server's default file upload limit.

Don't worry, it's not every bit difficult as it sounds. We will share four dissimilar methods and you can choose whichever method you find comfortable and easy to execute.

📚 Table of contents:

  1. Change PHP configurations on cPanel
  2. Edit the .htaccess file
  3. Edit the wp-config.php file
  4. Update php.ini via FTP

What causes the "the uploaded file exceeds the upload_max_filesize directive in PHP.Ini" error?

In the introduction, we talked about how your hosting prevents large files like images, videos, plugins, or themes from being uploaded to the server. They want to ensure that the server resources are existence adequately shared among its users. By putting a cap on the file size, they brand sure that no unmarried website is using a disproportionate amount of server space or retentivity.

In WordPress, you tin can check your upload limit by opening the Media Library upload area – Media > Add together New.

maximum upload size on media wordpress
Finding maximum upload size on WordPress

The practiced news is you can overcome this hurdle by changing the default limit. However, in that location are risks involved. One of the virtually common risks that you encounter is past making the slightest of error in the .htaccess or wp-config file and your unabridged website would come down crashing.

To safeguard your site from such a nightmare, we recommend taking a fill-in of your website earlier trying whatever of the tips in this commodity.

How to prepare the "upload_max_filesize" mistake in WordPress

To upload a large file into your website, all you need to do is increase the upload limit on your server. We'll share four different methods to accomplish this – at least i of them should work for your site.

Note: You can adjust the upload limit to the desired value as long as your hosting provider supports it. If your file size is 10MB and your hosting supports upwardly to 8MB, then you'd have to motion to a better hosting provider.

To discover your PHP retentiveness limit, go to Tools > Site Wellness > Info.

site health in wordpress
Finding PHP memory limit on WordPress

ane. Change PHP configurations on cPanel

Let's outset with the easiest method, which should work fine as long as your host uses cPanel for the hosting dashboard.

If your hosting provider doesn't offer cPanel, you tin can try one of the other options on this list.

Here's how to increase the max upload size in cPanel:

  1. Log into your hosting account.
  2. Open cPanel.
  3. Go to Select PHP Version > PHP Options/Options. Or, in some situations, you might need to look for a tool called MultiPHP INI Editor.
  4. Change the value for upload_max_filesize according to your needs.
php option in file manager
Increment upload limit in the cPanel

2. Edit the .htaccess file

The .htaccess file lets you control key configuration details for your web server. On many hosts, you tin can edit this file to increase the max upload filesize limit

Needless to say, it'due south an extremely crucial file and should be handled with caution.

To commencement, connect to your server using an FTP client. If you're not sure how to do that, follow our detailed FTP guide.

Before making whatsoever changes, download a copy of the .htaccess file onto your reckoner every bit a backup selection. That style, if yous encounter a problem, you can just delete the edited file from your website and upload the sometime file to make things go back to how they were.

download htacess from htaccess
Downloading file from Filezilla

Once you have your backup re-create, right-click to edit the file on your server. And so, add together the post-obit code snippet and adjust the values based on your need:

          php_value upload_max_filesize 128M php_value post_max_size 128M php_value memory_limit 128M        
editing htacess file - upload_max_filesize directive in PHP.ini
Editing the .htaccess file

Close the file, become to your website, and check whether yous tin can upload big files.

Some of you may encounter the following error afterwards inserting the code – Warning: PHP runs in CGI-mode.

If you run across this message, it means you lot tin't use this command in the .htacess file because of how your hosting environment is configured. Remove the lawmaking snippet and try some of the side by side methods.

iii. Edit the wp-config.php file

The wp-config.php file contains of import configuration details for your WordPress site. Without the config file, y'all volition lose access to your site's content. Handle the file carefully.

Every bit part of those configuration details, you tin make changes to the maximum upload limit on your site.

To begin, connect to your website using an FTP client and download a copy of the wp-config.php file every bit a safe net. If anything goes wrong, you lot tin reupload this copy to your site to make things go dorsum to how they were.

Next, edit the file and insert the post-obit code snippet higher up the /* That'southward all, end editing! line every bit shown in the image below. Brand certain to change the value based on how large files are to exist allowed on your website.

@ini_set('upload_max_size' , '128M' );

editing wp-config file - upload_max_filesize directive in PHP.ini
Editing the wp-config file

Salvage the file, leave, and check if y'all tin can upload large files to your website. If you can't upload the file, then try the next method.

4. Update php.ini via FTP (didn't work for us)

The php.ini is a configuration file and modifying information technology will override your server settings. Updating the file didn't work for us but it is a pop method recommended by hosting providers so we suggest y'all give information technology a try.

Whether or not information technology works really depends on how your hosting server is configured, and so it might work for you even though it didn't work for u.s..

Make certain y'all have backed upward your website before proceeding with the steps.

Like all other configuration files (i.e. wp-config and .htaccess), the php.ini should be located in your root folder.

Connect to your website using an FTP client.

If you lot see an existing file called php.ini, save information technology on your local computer as a backup. Open the file and you should find an option that says upload_max_filesize = 128M. Change the value to any suits you all-time.

If you don't see an existing file called php.ini, you lot tin can just create a new ane in the root binder. Then, edit information technology and add the following line:

upload_max_filesize = 128M

Brand certain to save your changes when you lot're washed.

create new file in file manager - upload_max_filesize directive in PHP.ini
Creating a new file in the File Managing director

Set up the "upload_max_filesize directive in PHP.ini" error for good

In this tutorial, we covered four different means of fixing the "The uploaded file exceeds the upload_max_filesize directive in php.ini." fault in WordPress.

If none of the methods worked for you, nosotros recommend uploading the file via FTP and so importing it to your Media Library using a plugin like Add together From Server. But if that fails too, you volition need to talk to your hosting provider about having them increase the upload limit for you.

Do you lot still have any questions about how to fix the "upload_max_filesize" error? Let us know in the comments below.

Free guide

5 Essential Tips to Speed Up
Your WordPress Site

Reduce your loading time by even l-80%
just past following simple tips.

Download complimentary guide

timmonscasuld.blogspot.com

Source: https://themeisle.com/blog/the-uploaded-file-exceeds-the-upload_max_filesize-directive-in-php-ini/

0 Response to "The Upload File Exceeds the Upload_max_filesize Directive in Phpini"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel