PHP scripts come in handy for managing dynamic content, session tracking, databases, and building entire e-commerce websites. So, it is pretty obvious that you might need to have larger scripts on your server. As a default, the upload size is set to 50 MB. When you need to change that, you can simply make some modifications to the php.ini file. To know how to increase the maximum upload file size in cPanel, read on.
Some prerequisites you need to check
But before you go forward with this, you need to double-check something. Make sure that your PHP is set to a Single php.ini option in the cPanel. This is the first step if you would like to know how to change file size. Here, the FastCGI settings or the default options would not work. You will need to take a look at the PHP Version Selection option if you do not know what this means.
The phpMyAdmin in the cPanel will not be disturbed when you do this. A different php.ini file is used there, which is accessible only to the server administrators.
You need to start by accessing your Bluehost account. If you are not sure if you are using Bluerock or Legacy, find that out first.
Make changes to the php.ini file
There are two parameters in the php.ini file that you ought to be changing for changing the PHP max upload size. These are:
Let us see how you can change both of them in Bluerock and in Legacy.
- Log in to your Bluehost control panel
- Click on the Advanced tab. You can find it on the navigation menu on the left
- Click the File Manager option under that in the file section
- On the right-side panel, you will have to scroll down and find the php.ini file
- Right-click on the file and select the Edit option
- When the file opens, search for the parameters that you need to change. Use the keyboard shortcut for that:
- For Windows/Linux: Ctrl+F
- For Mac: Command+F
- Type in upload_max_filesize and press Enter. The line with upload_max_filesize = 50M will get highlighted. You need to reset the maximum limit here
- Again open the ‘Find’ window and type ‘post_max_size’. You will find the option post_max_size = 50M highlighted. You will need to enter the same size (as you entered in the previous parameter) here as well. In this way, you can change the post max size in PHP
- Now you click on Save to save the changes
If you do not have the php.ini in File Manager, you would be able to edit the parameters through the MultiPHP INI Editor under the Software section.
Start by logging in to your Bluehost control panel.
- Open File Manager in the file section
- Choose to open Web Root and Show the hidden files and click on the Submit button
- Scroll in the right-hand panel to locate the php.ini file
- Right-click on the file and select the Code Edit option
- Click on edit in the pop-up for character set selection.
- Use the keyboard shortcut to open the Find window:
- For Windows/Linux: Ctrl+F
- For Ubuntu: Command+F
- Type in upload_max_filesize and press Enter in the Search field.
- This will highlight that parameter and it will be set as upload-max_filesize = 50M. Change this value to your preferred size.
- For the second parameter, open the Find dialog again and type post_max_size, and press Enter.
- You will find another highlight as post_max_size = 50M. Change this number to the same value you put in the other field.
- Save the changes you made. When you change these parameters that control the PHP upload file size limit, your job is done.
Some of the incoming data will have to be stored in memory at times when the PHP engine is handling an incoming POST call. This will only be effective in the case that you have enabled the –enable-memory-limit option when you have added or updated the configuration. However, you need to keep something in mind. If you had set a very high value, that would be a dangerous mistake. A lot of uploads will be handled concurrently. This would lead to maxing out the memory limit and cause issues in performance.
The maximum lifetime of the script and the time that the script would allow for input can be mentioned in these settings. If a lot of data is being transferred, which could be several megabytes, the max_input_time should be quite high. It is possible for you to change this setting in the .ini file as well. You can change the max_imput_time by calling the set_time_limit() function in the scripts.
You can even tweak Apache settings
By default, the Apache webserver will restrict all the POST data size through the LimitRequestBody configuration directive. Regardless of the scripting language that you are using, this setting would be applicable. There are some RPM installations where the limit request body is set to 512 Kb. You can either change the value to something larger or you could completely remove this entry to do away with the limits. This is another point you should remember when you want to know how to increase upload file size in WordPress.
What other options are available to you?
Well, if you are expecting that these settings would not be enough, you would probably need to use a PERL or Java server-side component. You might have a preference for PHP as a web programming language. However, when it comes to file handling, PERL can definitely give you an edge. When you are trying to look into how to increase maximum upload file size in cPanel, this piece of information will be useful to you.
Most of the PERL installations for the Apache module allow you to accept 32 MB right out of the box. With PHP, you get a default of just 2 MB. The only problem with PERL is that you would need to put a little more coding effort when compared to PHP. However, if you are trying to get good results, you should consider doing that.