找不到WordPress插件目录。Ftp_base不工作吗?

时间:2013-09-21 作者:simon

我有Wordpress 3.6在ubuntu 12.04 LTS和apache2上运行。Wordpress在apache上的根目录已用完,即/var/www

我有一个FTP服务器设置(VSFTPD)。我将其设置为chroot到FTP用户的主目录。

我设置了一个FTP用户,在主目录中有一个名为public\\u html的文件夹。在那里,我装载了/var/www,以便用户可以访问apache上的根目录。

我在VSFTPD上设置了002的UMASK,在/var/www上设置了dr-xrwsr-x。在/var/www中的所有目录都是775,所有文件都是664。

我可以与ftp用户一起登录到ftp服务器,并按预期在/public\\u html中创建、覆盖和删除任何我喜欢的文件和文件夹。

如果我使用wordpress安装具有相同ftp凭据的插件,它将失败Unable to locate WordPress Content directory (wp-content).

我检查了wp-config.php documentation, 上面说要添加FTP_BASE 到我的配置,我喜欢这样:

define(\'FTP_BASE\', \'/public_html/\');
我重新启动了apache,注销并重新登录到wordpress。插件安装仍然失败,并显示相同的消息。

如果我在VSFTPD中打开协议调试(log_ftp_protocol=YES), 我可以看到wordpress登录到VSFTPD,但它从未将目录更改为/public\\u html,尽管我的配置中设置了FTP\\u BASE。

奇怪的是,它确实尝试将内容CD到/var/www/wp,这显然行不通。发生了什么事?Wordpress是否忽略了我的FTP_BASE?

我的vsftpd日志:

Sat Sep 21 04:16:15 2013 [pid 2] CONNECT: Client "w.x.y.z"
Sat Sep 21 04:16:15 2013 [pid 2] FTP response: Client "w.x.y.z", "220 (vsFTPd 2.3.5)"
Sat Sep 21 04:16:15 2013 [pid 2] FTP command: Client "w.x.y.z", "USER ftpuser"
Sat Sep 21 04:16:15 2013 [pid 2] [ftpuser] FTP response: Client "w.x.y.z", "331 Please specify the password."
Sat Sep 21 04:16:15 2013 [pid 2] [ftpuser] FTP command: Client "w.x.y.z", "PASS <password>"
Sat Sep 21 04:16:15 2013 [pid 1] [ftpuser] OK LOGIN: Client "w.x.y.z"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "230 Login successful."
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "PASV"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "227 Entering Passive Mode (w,x,y,z,204,159)."
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "TYPE A"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "200 Switching to ASCII mode."
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "NLST /var/www/wp-content"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "150 Here comes the directory listing."
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "226 Transfer done (but failed to open directory)."
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "PWD"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "257 "/""
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "PASV"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "227 Entering Passive Mode (w,x,y,z,102,89)."
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "NLST /"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "150 Here comes the directory listing."
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "226 Directory send OK."
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "CWD /"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "250 Directory successfully changed."
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "PWD"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "257 "/""
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "CWD /"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "250 Directory successfully changed."
...(above 10 lines repeated 4 times)
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "QUIT"
Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "221 Goodbye."

2 个回复
SO网友:tanktop

好吧,这听起来可能很疯狂,但您是否尝试过绝对目录引用,即。/var/www/public_html/ 对于FTP_BASE?

抄本上确实说:

FTP\\u BASE是WordPress安装的“BASE”(ABSPATH)文件夹的完整路径。

SO网友:taur

重新创建folderpath并将back-to-doc根符号链接到../-链条使问题消失,这是一个不可思议的修复不应该被打破的东西。例如(docroot位于/路径/到/docroot):

mkdir -p /path/to/docroot/path/to
ln -s ../.. /path/to/docroot/path/to/docroot

结束