We understand the excitement that comes with discovering new plugins to take your website to the next level. However, we also recognize the occasional frustration when those plugins just refuse to install.
When you can’t install a WordPress plugin, there can be multiple reasons why this is happening. We’re here to help you find out what happened and show you how you can fix it.
Usually, not being able to install a plugin on WordPress comes down to a few key issues. We’ll cover all of these below. Let’s start with the most common issues.
1. Wrong directory and file permissions/ownership
This can happen due to incorrect file or directory permissions, ownership, or both. This error can also be found as a 403 forbidden error and may happen while transferring or editing files via FTP or SSH with different Linux users.
To fix this issue, make sure all folder permissions are set to 755 and all file permissions are set to 644. This lets only the file owner have full access to the files and folders. You can easily do this with the chmod command inside the DocumentRoot of your WordPress website on the specific files and directories with incorrect permissions.
You can also change the permissions for all the files and directories in the DocumentRoot with these commands. Make sure you are already inside the folder where your WordPress installation is:
find . -type f -exec chmod 644 {} +
find . -type d -exec chmod 755 {} +
You may also need to change the ownership of the files and directories to your web server’s user. Depending on your web server and Linux distribution, this user is named differently. It could be www-data, nginx, or apache.
To set the ownership of your WordPress installation, let’s say your WordPress is installed at the directory /var/www/html/wordpress/. To change the ownership of the entire installation to your web server user (in our example it is www-data), you can do that like so:
chown -R www-data:www-data /var/www/html/wordpress
With that, your web server should now be able to access all WordPress files and folders properly.
2. PHP memory limit is too low
Another error that you may face is exhausting your server’s PHP memory limit with the following error message:
Fatal error: Allowed memory size of X bytes exhausted.
In this case, you should increase the PHP memory limit from cPanel or by finding the php.ini file on your server and increasing the value for the memory_limit variable.
Changing your PHP memory limit using cPanel
You can change the memory limit from cPanel by logging in to your cPanel account and navigating to the “MultiPHP INI Editor” and selecting the WordPress domain. In the Select Location drop-down menu, then you can change the “memory_limit” value.
Changing your PHP memory limit using the php.ini file
If you are not using cPanel you can find the php.ini file by creating a phpinfo.php file that will show you the php.ini location on your server. In most cases it is found at /etc/php/php.ini.
Open the file using your preferred text editor. Then edit the memory_limit variable. If it is set to 128M for example, set it to 256M or 512M.
3. Incompatible plugin
Sometimes plugin incompatibility may be the issue when you are installing a new plugin. You may have a conflict between your already installed plugins, or your theme. Due to this, you won’t be able to install the new plugin. You can test this by installing a WordPress plugin compatibility checker or disabling all the plugins one by one to check which plugin is causing the issue.
Some of the plugins may have requirements which you can check before installing. This may include incompatibility with certain plugins or themes, which PHP or WordPress versions can be used and possibly even required plugins that you might not have installed.
4. Insufficient access rights
Don’t forget to check the WordPress user that you are logged in as when trying to install plugins. You may be logged in with a WordPress user whose role is Author, Editor, Contributor or Subscriber.
Unfortunately, to install WordPress plugins or themes you should be logged in with an Administrator or Super Admin user on your WordPress. Only these WordPress roles can install or manage plugins and themes.
5. Debugging errors
For some errors you may need more information to find out what went wrong. For this purpose, you can enable WordPress debugging.
To do this, you should navigate to the DocumentRoot of the WordPress website and edit the wp-config.php file. You should find the following line in the file: (‘WP_DEBUG’, false);
Then you change it to true and add the following lines to enable debugging:
define( ‘WP_DEBUG’, true );
// Enable Debug logging to the /wp-content/debug.log file
define( ‘WP_DEBUG_LOG’, true );
// Disable display of errors and warnings define( ‘WP_DEBUG_DISPLAY’, false );
@ini_set( ‘display_errors’, 0 );
define( ‘SCRIPT_DEBUG’, true );
Then go ahead and save the wp-config.php file edits and check the log file that you can find in wp-content/debug.log inside your WordPress base directory.
Depending on the output of that log, there could be a bug in the plugin you have, or the plugin code itself may crash due to incompatibility. You’ll have to see what the log output contains.
If you’re lacking storage or RAM however, you should consider moving to a provider that can give you more resources for your money. Our affordable Linux VPS hosting plans let you run your WordPress websites with plenty of resources. All of this at a reasonable price just about anyone can afford.