How Do I Increase The PHP Upload Limits in cPanel?

PHP has several configuration options to limit resources consumed by scripts. By default, PHP is set to allow uploads of files with a size of 2MB or less.

 You are able to upload small files in webmail or with a PHP script, but larger files cannot be uploaded or you get "The page cannot be displayed" error when you push the "Send Message" button.

 While there are several ways to remove this cap on file size, we’ll be working with three settings within PHP that should deal with the upload limit. Let’s define the settings first so that you know what you’re actually doing.

  • Upload_max_filesize

This defines the maximum upload limit for files.

  • Post_max_size

This defines the maximum upload limit that will be handled in a POST request.

  • Memory_limit

This defines how much memory is allocated for PHP. This number should be equal or higher than the upload_max_filesize.

How to increase PHP Upload Limit and Post Max Size and Memory Limit?

Login to cPanel Server and Navigate ‘Select PHP Version’


Click on ‘Switch To PHP Options’


  • Set memory_limit to 256M. memory_limit describes the maximum amount of memory a script can allocate. It is recommended to set this to maximum available value.

  • Set upload_max_filesize to 32M. upload_max_filesize describes a maximum size of an uploaded file. It must be larger than the theme file mentioned in the example.

  • Set post_max_size to 64M. post_max_size has a similar functionality to upload_max_filesize. Make it larger than 19 MB (theme file) as well.


Click ‘Save’ button to save the changes.

cPanel server change php.ini using command line

You can change the PHP.INI config values by logging into to your command line, using SSH or putty program or directly logging into server console.
Once you login into your server, You will reach the bash prompt or shell.


You can find out the PHP.INI file using the following command

php -i | grep "php.ini"
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini

As you can see the loaded config file above, Edit it using any editor such as vim/emacs/nano and modify the desired values.

or you can write a simple test.php file with the following content to know the php.ini path.

When you execute the command, You will know the loaded php.ini file and edit it.