Wordpress fails to install plugins: Unable to locate WordPress Plugin directory

I am unable to install plugins on my Centos 6 VPS. When I attempt the install I get this:

Installing Plugin: BotDetect WordPress CAPTCHA 3.0.Beta1.7

Downloading install package from
[web path to:]botdetect-wp-captcha.zip…
Unpacking the package…
Could not create directory.
Return to Plugin Installer

UPDATE: This seems to have something to do with permissions -- I'm guessing there's some group that wordpress needs to be part of in order to change folders, create files, etc., but I can't figure out what that group should be. I have no www-data group -- I read something somewhere about this being a requirement. Can somebody tell me what groups and permissions need to exist for WP to operate?

UPDATE: I have chmodded the permissions to my plugin and uploads folders to 777. I also have created an FTP user specifically for Wordpress and made the home directory for that user the same as my Wordpress root folder as recommended HERE. I then changed these lines in the wp-config.php file from:

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__ . "/"));

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

to:

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__));

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . '/wp-settings.php');

This should eliminate the double slash conflict mentioned HERE.

Note -- I was also having a problem uploading media but that issues was resolved with the chmod to 777.

Now when I try to install a plugin I get this:

Unable to locate WordPress Plugin directory.<br>
Return to Plugin Installer


UPDATE: Per suggestions I have run chown -R on my wordpress directory and reverted my wp-config.php file back to this:

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
        define('ABSPATH', dirname(__FILE__) . "/");

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

My permissions look like this. I still have the problem.

[[email protected]_IP/wordpress]# ls -l
total 180
-rw-r--r--  1 apache apache   418 Dec 16 07:07 index.php
-rw-r--r--  1 apache apache 19929 Dec 16 07:07 license.txt
-rw-r--r--  1 apache apache  7183 Dec 16 07:07 readme.html
drwxr-xr-x  2 apache apache  4096 Dec 17 14:57 tmp
-rw-r--r--  1 apache apache  4892 Dec 16 07:07 wp-activate.php
drwxr-xr-x  9 apache apache  4096 Dec 16 07:07 wp-admin
-rw-r--r--  1 apache apache   271 Dec 16 07:07 wp-blog-header.php
-rw-r--r--  1 apache apache  4795 Dec 16 07:07 wp-comments-post.php
-rw-r--r--  1 apache apache  3087 Dec 16 07:07 wp-config-sample.php
-rw-r--r--  1 apache apache  3124 Dec 19 06:10 wp-config.php
drwxr-xr-x  6 apache apache  4096 Dec 18 21:03 wp-content
-rw-r--r--  1 apache apache  2932 Dec 16 07:07 wp-cron.php
drwxr-xr-x 12 apache apache  4096 Dec 16 07:07 wp-includes
-rw-r--r--  1 apache apache  2380 Dec 16 07:07 wp-links-opml.php
-rw-r--r--  1 apache apache  2359 Dec 16 07:07 wp-load.php
-rw-r--r--  1 apache apache 31909 Dec 16 07:07 wp-login.php
-rw-r--r--  1 apache apache  8235 Dec 16 07:07 wp-mail.php
-rw-r--r--  1 apache apache 10880 Dec 16 07:07 wp-settings.php
-rw-r--r--  1 apache apache 25665 Dec 16 07:07 wp-signup.php
-rw-r--r--  1 apache apache  4026 Dec 16 07:07 wp-trackback.php
-rw-r--r--  1 apache apache  3015 Dec 16 07:07 xmlrpc.php


Answers

In my case the wp-content directory only had a plugins.old directory. I created a plugins directory and ran "chmod wwwrun:www plugins/" to get the plugins to install. Running opensuse leap 42.2.

Posted on by Jeff Seaton
  • First of all, make sure your WP public folder is owned by the apache user (depending on your system, it should be apache or www-data):

sudo chown -R apache:apache /path/to/wordpress

  • Then edit the vsftpd.conf file

sudo vim /etc/vsftpd.conf

  • and make sure that the line containing the 'write_enable' is uncommented and its value is set to 'YES'

... write_enable=YES ...

Posted on by Mohamed Ayoub BENJELLOUN

It helps to set the ftp access on the wp-config.php file. as descrived on this post.

https://digwp.com/2010/11/ftp-in-wpconfig/

define('FS_METHOD', 'ftpext');
define('FTP_BASE', '/yourftpfolder/');
define('FTP_USER', 'youruser');
define('FTP_PASS', 'yourpassword');
define('FTP_HOST', 'yourhost.com');
define('FTP_SSL', false);

Posted on by Adrian Sosa

Okay, I figured this out based upon the suggestions above. This is how I resolved this issue:

  1. I created a group called ftpusers.

    groupadd ftpusers

  2. I added my wordpress user to this group.

    usermod -a -G ftpusers wordpressuser

  3. I changed ownership of the wordpress folder recursively to my wordpress user:group.

    chown -R wordpressuser:ftpusers wordpress

Voila -- my package installed.

Posted on by user1780242

The issue you're having is with ownership of the files. The folder is owned by a different user than the webserver therefore WP can't create a directory for the plugin you're attempting to download.

The changes you have made to wp-config.php need to be reversed.

Then SSH into your server and run:

sudo chown -R apache:apache /path/to/wordpress/dir

Replace apache:apache with a different user:group if your configuration is different.

Posted on by Nathan Dawson