In some cases, default server settings may not let you upload larger files via your website. This tutorial shows how to increase PHP upload limit in cPanel or by modifying .htaccess file.
Option 1 – Increasing PHP upload Limit in cPanel
Step 1 — Opening up PHP Settings
Log in to your cPanel and navigate to Select PHP Version –> Switch to PHP Options:
Step 2 — Changing Upload Limit values
Let’s say you are having an error while trying to upload 19 Mb WordPress theme file through your WordPress Admin Area.
The following configuration illustrates appropiate settings for this example:
- Set memory_limit to
128M
. memory_limit describes the maximum amount of memory a script can allocate. It is recommended to set this to maximum available value. Letter Mstands for megabytes. - Set upload_max_filesize to
64M
. 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.
Don’t forget to Save the changes.
Option 2 – Increasing PHP Upload Limit Using .htaccess
If there is no possibility to edit PHP settings via your cPanel, you can use another method which involves editing your .htaccess file by connecting via FTP Client. The following tutorial explains connecting via FTP Client in detail:
Note that .htaccess file is a hidden file, therefore you may need to enable its visibility.
Add the following lines to .htaccess file to increase upload limit:
php_value post_max_size 64M