Want to upload your favorite WordPress theme but getting errors that the file size exceeds the maximum upload size for this site? This error message is common especially for new WordPress website owners.
WordPress application uses PHP to function and PHP default settings is set to limit file being uploaded to the maximum size of 2MB on most systems. If WordPress is uploading anything larger than 2MB, that process will fail.
The issue is not a WordPress issue. It is a PHP setting that limit the upload size for files. So to get this working in WordPress, you must increase the file upload size in PHP.
This brief tutorial is going to show new users and students a simple way to fix this issue. Once the issues is resolved, you’ll be able to upload up to the maximum size you set in PHP on your server.
To get started, follow the steps below:
Step 1: Identify PHP Configurations file.
The first step is configuring this setting is to first find the location of PHP configuration file. It varies on most systems. A simple way to find where PHP default configurations file is stored is to run the command below
When you run the command above, you’ll see a list of locations for PHP modules configurations. The main file you’re looking for is Loaded Configuration File. This is the default configuration file that is loaded each time PHP runs.
Configuration File (php.ini) Path: /etc/php/7.0/cli Loaded Configuration File: /etc/php/7.0/cli/php.ini Scan for additional .ini files in: /etc/php/7.0/cli/conf.d Additional .ini files parsed: /etc/php/7.0/cli/conf.d/10-mysqlnd.ini,
Step 2: Change PHP File Upload Limits
Now that you know which file is the default file, run the commands below to open it.
sudo nano /etc/php/7.0/cli/php.ini
Then use the down arrow key to scroll down in the file and modify these highlighted lines. You should also see the section that reads “File Uploads”, below that you’ll find PHP default file maximum upload size. Change it there too.
;PHP Limits ; max_execution_time = 600 max_input_time = 900 memory_limit = 256M post_max_size = 32M ; ; ;;;;;;;;;;;;;;;; ; File Uploads ; ;;;;;;;;;;;;;;;; ; Whether to allow HTTP file uploads. ; http://php.net/file-uploads file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). ; http://php.net/upload-tmp-dir ;upload_tmp_dir = ; Maximum allowed size for uploaded files. ; http://php.net/upload-max-filesize upload_max_filesize = 100M
Change the highlighted lines to higher value to allow WordPress to upload content to to that value, then save the file.
Step 3: Restart or Reload your Web server
After making the above changes, restart your web server.
sudo systemctl reload apache2.service sudo systemctl reload nginx.service
Try again. and this time it should work.
You may also like the post below: