setting the variables

How to Increase PHP upload maximum file size

Having trouble uploading large file via your website media uploader? The first thing you look at is to increase PHP upload maximum file size. Sure, there are many factors that contribute to this problem. But it’s best to look at the most common ones.

Easy ways to increase PHP upload maximum file size 

I will lay down how I increase PHP upload maximum file size in two different web development environments. The first one is through cPanel in your web hosting and the other one is through WampServer in your local Windows operating system

For those of you who have no idea what PHP is, it is a general purpose scripting language for web development. Unless your website is built on different languages, then perhaps you can leave this piece of tutorial.

Before you want to increase the settings, there are three variables that you need to understand which are:

  1. memory_limit
  2. post_max_size
  3. upload_max_filesize

These three variables are given a value which can be set by you. However, you have to understand that increasing or decreasing these values will affect.

memory_limit – recommended to put 128M. This is to determine the bits of script allowed to be allocated in the memory of your machine

post_max_size – the maximum size of data that can be posted using PHP POST method. Typically smaller than memory_limit and larger than upload_max_filesize.

upload_max_filesize – Maximum file size you can upload. The best value you can set here is smaller than both memory_limit and post_max_size.

Now you have known how the value affect each other, let’s begin to increase the PHP upload_max_filesize variable.

Increase PHP upload maximum file size in cPanel

If your are doing your web development in the live server of your web hosting, please follow these steps:

Step 1: Login to your web hosting cPanel

Step 2: At the homepage of your web hosting’s cPanel, click on the “Select PHP version” under the Software menu.

increase php maximum upload file size

Step 3: At the PHP Selector page, click on the Options tab. 

Step 4: Now, put all your desired value to memory_limit, post_maxt_size and upload_max_filesize. General rule here is, making sure that the upload maximum file size is not larger than the two. 

setting the variables

There you have it. Once you change the value, the system automatically Saved it.

Increase the Variable in WampServer

Let’s see how we do it in WampServer if you are doing the web development in your Windows local machine.

taskbar wampserver

Step 1: Launch the WampServer application in your Windows machine.

Step 2: Click the WampServer icon in the taskbar.

php on wampServecr

Step 3: Click on the PHP and then PHP Settings.

php variables selector

Step 4: Now, you can see all the needed variables that you need to change. The general rule of changing these variables applied with WampServer also.

When you change every single variable, the web server will always restarted to apply the changes. 

Conclusion

Again, if you encountered problem in uploading large file through your website upload manager or media manager, please look into this solution first. If this does not help, then you can try other ways to troubleshoot the problem.

It could be the file type or the extension of the file you are planning to upload into the server. If this is the case, please make sure that you subscribe to the blog because this is going to be my next tutorial.

2

No Responses

Write a response