Installing WordPress is pretty easy. Many of our tutorials on this site about installing WordPress can be accomplished in about 15 minutes. Once WordPress is installed, managing it can be a little tricky for new users and students.
One of the many issues new users and students find after installing WordPress is uploading new themes or plugins that are huge in size. By default, WordPress installed using PHP can only allow probably file size that are 2MB and less.
Uploading anything above that size may fail during the process.
This brief tutorial is going to show users how to fix a common error when uploading larger content in WordPress. These error messages are common when uploading huge themes or plugins.
- ‘The uploaded file exceeds the upload_max_filesize directive in php.ini’
- xcontent exceeds the maximum upload size for this site
When you get the above message, don’t panic. Follow the steps below to to resolve the issues.
Step 1: Locate PHP Configuration file
To resolve the issues above, first thing is to locate PHP default configuration file. The configuration file contains all the directives that control how PHP handles basic operations. To find out where that file is, run the commands below
You’ll get a result as shown below after running the commands above.
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
The highlighted line above is the default PHP configuration file.
Step 2: Edit the PHP configuration file
Now that you know what file to edit, run the commands below to open the file.
sudo nano /etc/php/7.0/cli/php.ini
When the file opens, find for the lines that look like the ones below
file_uploads = On
upload_max_filesize = 100M
memory_limit = 256M
post_max_size = 32M
max_execution_time = 600
max_input_time = 900
When you’re done save the file.
After saving the PHP file, restart your web server
The settings above set the following parameters:
- file_uploads = file uploading will be enabled
- upload_max_filesize = the maximum file size that can be uploaded
- memory_limit = amount of memory a script can consume
- max_execution_time = the maximum time in seconds a script is allowed to run before it’s terminated
This post shows you how to adjust PHP settings to allow larger content to be uploaded in WordPress. By default PHP is configured to only allow up to 2MB in size. If you don’t adjust the settings above, you may not be able to upload larger content.
You may also like the post below:
Installing Komodo Edit 10 on Ubuntu 17.04