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

CP_2.png

Click on ‘Switch To PHP Options


CP_3.png

  • 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.

CP_4.png

Click ‘Save’ button to save the changes.