Uploading files is important when you need to upload your paid themes and plugins onto your WordPress. Most of the cases your zip files are larger than the default allowed file size set by PHP. Many of admins struggle setting this configuration to allow you to do the job. Here is the solution to fix this issue.
By default, PHP ships with the settings of:
upload_max_filesize = "2M"
post_max_size = "8M"
This means a single uploaded file must be smaller than 2 Megabytes, you can upload 4 files at the same time to reach 8 Megabytes in a single upload request.
To modify this configuration would require to modify the php.ini or php-fpm.conf. This usually requires root or administrator access to the server, and may not apply to some web hosting services or shared WordPress service. In this case, there is an alternative but an easy way to solve this issue.
1. Locate the .htaccess file under the root of the web directory. This should be automatically created by WordPress for you. Make sure you use ls -la
to list out hidden files that has a .
before the filename.
2. Edit .htaccess. If you are using CLI or SSH, you can use commands of vi
, nano
, mc
or etc. Add the following lines and adjust your desire values.
upload_max_filesize
means the maximum size of a single file.
post_max_size
means the total size of a single request.
Recommended: post_max_size >= upload_max_filesize
php_value upload_max_filesize 64M
php_value post_max_size 64M
After that, save the file and retry uploading. You should able to see the maximum file size changed.
Reference:
PHP.net explanation of upload-max-filesize – https://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize