Wordpress 无法安装插件:无法找到 WordPress 插件目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20673184/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Wordpress fails to install plugins: Unable to locate WordPress Plugin directory
提问by user1780242
I am unable to install plugins on my Centos 6 VPS. When I attempt the install I get this:
我无法在 Centos 6 VPS 上安装插件。当我尝试安装时,我得到了这个:
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?
更新:这似乎与权限有关——我猜想 wordpress 需要加入某个组才能更改文件夹、创建文件等,但我不知道该组应该是什么是。我没有 www-data 组——我在某处读到了一些关于这是一个要求的内容。有人可以告诉我 WP 需要存在哪些组和权限才能运行吗?
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:
更新:我已经chmodded权限,以我的插件和上传文件夹,777我也已经创建了一个FTP用户专门为Wordpress和取得的主目录为该用户推荐同我的WordPress的根文件夹的位置。然后我将 wp-config.php 文件中的这些行从:
/** 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.
注意——我在上传媒体时也遇到了问题,但是这个问题通过 chmod 到 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:
更新:根据建议,我在 wordpress 目录上运行了 chown -R 并将 wp-config.php 文件恢复为:
/** 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.
我的权限是这样的。我仍然有问题。
[root@ip-MY_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
回答by Nathan Dawson
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.
您遇到的问题是文件的所有权。该文件夹由与网络服务器不同的用户所有,因此 WP 无法为您尝试下载的插件创建目录。
The changes you have made to wp-config.php need to be reversed.
您对 wp-config.php 所做的更改需要撤消。
Then SSH into your server and run:
然后通过 SSH 连接到您的服务器并运行:
sudo chown -R apache:apache /path/to/wordpress/dir
Replace apache:apache with a different user:group if your configuration is different.
如果您的配置不同,请将 apache:apache 替换为不同的 user:group。
回答by user1780242
Okay, I figured this out based upon the suggestions above. This is how I resolved this issue:
好的,我根据上面的建议想到了这一点。我是这样解决这个问题的:
I created a group called ftpusers.
groupadd ftpusers
I added my wordpress user to this group.
usermod -a -G ftpusers wordpressuser
I changed ownership of the wordpress folder recursively to my wordpress user:group.
chown -R wordpressuser:ftpusers wordpress
我创建了一个名为 ftpusers 的组。
groupadd ftpusers
我将我的 wordpress 用户添加到了这个组。
usermod -a -G ftpusers wordpressuser
我递归地将 wordpress 文件夹的所有权更改为我的 wordpress 用户:组。
chown -R wordpressuser:ftpusers wordpress
Voila -- my package installed.
瞧——我的包安装了。
回答by Adrian Sosa
It helps to set the ftp access on the wp-config.php file. as descrived on this post.
它有助于在 wp-config.php 文件上设置 ftp 访问。如本帖所述。
https://digwp.com/2010/11/ftp-in-wpconfig/
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);
回答by Jeff Seaton
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.
在我的例子中 wp-content 目录只有一个 plugins.old 目录。我创建了一个插件目录并运行“chmod wwwrun:www plugins/”来安装插件。运行 opensuse 飞跃 42.2。
回答by Mohamed Ayoub BENJELLOUN
- 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):
- 首先,确保您的 WP 公用文件夹归 apache 用户所有(取决于您的系统,它应该是 apache 或 www-data):
sudo chown -R apache:apache /path/to/wordpress
sudo chown -R apache:apache /path/to/wordpress
- Then edit the vsftpd.conf file
- 然后编辑vsftpd.conf文件
sudo vim /etc/vsftpd.conf
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'
...
write_enable=YES
...
...
write_enable=YES
...
回答by Ashok G
Just try chown R apache:apache
to the wordpress
directory or the entire public directory
刚刚尝试chown R apache:apache
的wordpress
目录或entire public directory