Increasing File Upload Size

While searching online you might have come across references to the PHP file size limit. Typically these are post_max_size and max_file_size You may be curious why you should increase post_max_size when you only want to increase the upload_max_filesize. To understand this we should first know what these methods do in PHP.

What is post_max_size

Typically this is set much higher however as an example, suppose your max_upload_file size is 8MB and in a page you are attempting to use images and perhaps a form with text. So if you have 3MB of text and 6MB of images your post size becomes 9MB which is more than your allowed post_max_size. Normally you want to keep post_max_size and upload_max_filesize the same.

What is upload_max_filesize

This is the size which is allowed to upload files. If upload_max_filesize is set to 150MB this means you cannot upload files larger than 150MB.

How to Modify the Values

MultiPHP INI Editor is included as part of cPanel and allows amongst other values, the post_max_size and upload_max_filesize to be modified.

You’ll first need to log into your cPanel account either directly through the server or your Client Area.

Under SOFTWARE click on MultiPHP INI Editor

MultiPHP INI Editor

The next step is to select the domain you wish to modify the PHP settings for. Under Configure PHP INI basic settings select the home directory or a domain’s document root to open the corresponding PHP configuration.

Select a location

We now have access to the PHP settings. Scroll down to post_max_size and upload_max_filesize adjusting the values as needed.

post_max_size

upload_max_filesize

Once these have been updated, click Apply at the bottom of the page.

To further confuse things, each application may have a way to modify their internal file upload size. For Omeka it’s the config.ini file. This is covered in a separate Help Article.

Increasing Memory Limit

PHP has certain limits that are used to keep PHP applications from monopolizing your allotted resources, and occasionally, a PHP application will hit these limits. Often times, the limit the applicaiton hits is the memory limit, and it will need to be increased to avoid those nasty out of memory errors. While some PHP applications, like WordPress, have their own ways to do this, setting these limits in the appropriate php.ini file should work for any PHP application.

php.ini is a file that configures how PHP works. This file can exist in your home directory to configure PHP across your account, or can exist in the directory of a domain to configure how PHP works on that specific domain. If a php.ini file doesn’t exist in a domain’s directory, PHP will look for one in your home directory, and if one doesn’t exist there, PHP will use a default server-level php.ini file.

image

Although you can wite your own php.ini file, by writing one using a text editor like vim or uploading one via SFTP/FTP, cPanel offers an interface that allows you to edit the more common settings like increasing the file upload size limit. To open the cPanel interface, click MultiPHP INI Editor in your cPanel.

There you should see a dropdown menu listing out all of the domains associated with your cPanel, and your home directory. If you want to increase the memory across your account, you can hit Home Directory but if you only need to increase it for a particular site, select that site.

Select a location

Scroll down a bit, and among all the other settings you should see memory_limit , and next to it a value in megabytes. You can adjust the value here (using M , not MB , when specifying the limit), and scroll down a bit more to hit Apply to save it. This will not only write the change to the php.ini file, but .htaccess as well.

image

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request