How to Fix or Increase PHP Maximum Upload Size
The fact that you’re reading this post means you have run into an issue while uploading files to your WordPress site. But don’t worry, I am going to offer your more than one quick fix for this issue. “Exceeds the maximum upload size for this site” is a common issue often experienced by professionals or web site owners while uploading an HTML file. Fortunately, you can increase your PHP maximum upload size to resolve this issue.
WordPress is the powerhouse of the internet and can be used for building and running any kind of personal or business site. If you still don’t have your own website, consider it a sign to get one. Moreover, with the advanced tools and technologies, having a site is quite easy now. Get TemplateToaster and create your own website using its drag and drop interface. Moreover, it also offers ready-to-use WordPress Themes. Given this, creating your own site is just a matter of a couple of dragging and dropping.
What is PHP Maximum Upload Size?
By default, PHP allows a maximum file upload of 2 MB. The limit exists for security and efficiency purposes as it prevents users from flooding your site with unnecessarily large media files.
Why increase PHP maximum upload size?
If you are not sure what the current maximum upload size is in your WordPress, you can check it by navigating to the WordPress admin panel> Media> Add New. You will see the maximum upload size on the bottom of the screen. First of all, it is not a WordPress issue. Resizing every file before uploading can be a time-consuming task. Therefore, you need to increase the upload size limit when necessary.
Fortunately, there are many ways to increase the upload file size limit in PHP as using any of the following explained methods. I am writing this guide to provide all possible solutions. However, depending upon your web host some methods may not work. In that case, try contacting your web hosting provider. Let’s get started.
How to Increase the WordPress Maximum upload file size?
It is important to understand why this issue happens in order to fix it. Many web hosting providers keep the limit low by default, so it can be your hosting provider’s issue or it can be a server-level issue. With this article, I will try to explain various root causes of the issue so you can figure out the right solution to fix it. Here are some ways you can go about resolving the WordPress Maximum upload file size issue. Let’s dig in-
Option 1: Fix or Increase PHP Maximum Upload Size in a Multisite install
If you are running a multisite installation, you might want to customize the upload limit for your site. However, you can only set the limit only if your server allows it. For instance, if your server is set to 20 MB then you can’t exceed the limits over 20 MB from your network settings, However, If your server is set to 20 MB, then you can set it up to 20 MB from your network settings. Follow the given steps-
Login to your WordPress admin panel and navigate to My Sites> Network Admin> Settings.
Scroll down and double click the Max upload file size option. Enter the value in KBs to increase the upload file size and click Save Changes to save the changes.
That’s it. You’ve successfully increased the upload size limit in a multisite installation.
Option 2: Fix or Increase PHP Maximum Upload Size using Web Hosting provider
If you do not feel comfortable with manual process, you should try doing it using your web hosting provider. There are two ways you can use to increase your PHP maximum upload size-
Using your hosting’s cPanel
If you are running your WordPress site on a host that offers cPanel then it should be easier for you to increase the size using the interface.
Step 1 : Login to your cPanel and click Select PHP Version under Software section.
Step 2: Click on Switch to PHP options.
Step 3: Now, click on upload_max_filesize option, select the value from the drop-down menu and click Save to save the changes.
The options can go with different names depending upon your web hosting provider. However, it should be similar enough for you to understand and make the changes accordingly.
Contact your hosting provider for help
If you are experiencing trouble uploading files but couldn’t make the changes yourself, you can also try reaching to your web hosting provider’s customer support. Almost every hosting company offers customer support to help their customers out in need. All you need to do is ask your customer support regarding the upload size limit and they will do it for you. The support staff is technical and upload limit is a trivial task for a tech support person, they should be able to do it within a minute.
Option 3: Server settings to Fix or Increase PHP Maximum Upload Size
If you are comfortable with modifying server settings, you should go with this method. There are a lot of server settings that can affect the way uploads are handled by your site. However, most tutorials get this wrong because they try to make unnecessary changes. According to the PHP Documentation, you need to consider following three directives only-
Post-max-size: This option sets the max size of post data allowed and also affects the file upload. In order to increase the upload limit, this value should be larger than upload_max_filesize
Upload_max_filesize: Defines the maximum size of upload allowed
Memory_limit: In case memory limit is enabled by your configure script, it also affects the file upload and should be larger than post_max_size in general.
You need to change the settings for these three directives to increase PHP maximum upload size. Here are the different ways to make server settings edits.
Increase upload size in your php.ini
php.ini files are there to govern the overall default set up of your server. To edit your php.ini file, login to your site via FTP or SFTP. Or you can also access your php.ini file from your site’s root directory and open or create a php.ini file. If you locate the existing php.ini file, then search for the following directives and change the values. Or you can also just copy and paste the following code-
upload_max_filesize = 15M post_max_size = 16M memory_limit = 18M |
The given values like 15M, 16M, and 18M, etc is not benchmarks. You can enter your desired values as well. However, make sure that memory_limit is higher than post_maxsize and post_max_site is higher than upload_max_filesize.
Edit .htaccess file
Depending upon the restrictions in your servers, you might not be able to use php.ini files. In the case, you can access and modify your .htaccess file. It is a special hidden file that contains various settings of your site. You can use settings to modify the server behavior, right down to a directory specific level. In case the above given method didn’t work, we suggest you try this method out. Login to your site using FTP, take a look at your root directory and locate the .htaccess file. Open and edit the file. Look for the following directives and change the values accordingly. Or just copy paste the following code to increase PHP upload size-
1.php_value upload_max_filesize = 10M 2.php_value post_max_size = 12M 3.php_value memory_limit = 16M |
Note: If you get an ‘internal server error’ message while editing the .htaccess file, it means your server is running PHP in CGI mode. Basically, this method won’t work and you can’t run above commands in your .htaccess file. YOu can revert back this code in that case.
Edit wp-config.php file
Another way of increasing your PHP maximum upload size is by editing wp-config.php file. You need to access your WordPress root directory using FTP or SSH and navigate to wp-config.php file. Now, open and edit the file. Look for the following directives and change the values accordingly. Or just copy paste the following code to increase PHP upload size-
1.@ini_set( ‘upload_max_size’ , ’18M’ ); 2.@ini_set( ‘post_max_size’, ’12M’); 3.@ini_set( ‘memory_limit’, ’10M’ ); |
Don’t forget to save your changes after editing your wp-config.php file.
Edit functions.php file of your theme
If none of the above mentioned server setting works, you can also try making changes in your function.php file of your theme. In some cases, you might not be able to access php.ini or .htaccess file, depending upon the restrictions on the server. However, you can increase the PHP maximum upload size by adding the given code in your functions.php file of your theme-
1.@ini_set( ‘upload_max_size’ , ’18M’ ); 2.@ini_set( ‘post_max_size’, ’12M’); 3.@ini_set( ‘memory_limit’, ’10M’ ); |
Note: Keep in mind that you need to edit your functions.php file every time you change the theme or else the maximum upload size will return to its default values.
Option 4: Fix or Increase PHP Maximum Upload Size Using a Plugin
I will recommend you to use any of the above explained methods to increase your PHP maximum upload size only if you can handle a little bit of technical methods. However, if you are just a beginner and not comfortable with manual modifications of server settings then I would recommend you to steer clear of any of the aforementioned methods. In such situations, I’d recommend you to use a plugin. There are various plugins available that can help you increase your PHP maximum upload size.
Quick recommendation: use Increase Max Upload Filesize plugin. This plugin can automatically detect the upload limits set by server, hosting providers, and WordPress. You can easily access the plugin’s settings from the main WordPress admin panel. This plugin is easy to install and easier to use. Moreover, it comes for free and you don’t have to pay for it to use it. Let’s get started with the steps to use it-
Login to your WordPress admin panel.
Navigate to your Dashboard> Plugins> Add New. Search for ‘Increase Max Upload Filesize’ and then activate and install the plugin.
After the successful installation, go to plugin settings and simply enter the value for upload size.
Click the Save Changes button to make the new changes.
That’s it. You’ve successfully increased the PHP maximum upload size using the plugin method.
Summary
WordPress is known for its flexibility. You can always modify it according to your need and there is always a way to do it. You can use any of the aforementioned methods to make the desired changes and increase the PHP maximum upload size. As you can see, increasing the upload limit is not that complex. Moreover, there are several ways to do it. Therefore, choose the method you feel most comfortable with and make the changes accordingly. We hope that this tutorial is helpful to you. For more tutorials like this, visit our blog. For more queries and recommendations, please comment below!
Build a Stunning Website in Minutes with TemplateToaster Website Builder
Create Your Own Website Now