最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

【已解决】WordPress安装升级或安装插件提示:To perform the requested action, WordPress needs to access your web server

安装 crifan 85浏览 0评论
之前已经在OneinStack的CentOS中安装过全新的WordPress了:
【记录】在阿里云香港ECS服务器的OneinStack中安装全新WordPress
结果,刚才尝试去更新插件或此处安装插件,都会提示:
Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.
Hostname
FTP Username
FTP PasswordThis password will not be stored on the server.
Connection Type FTP  FTPS (SSL)
Cancel 
看起来是没有操作服务器的文件和文件夹的权限啊
To perform the requested action, WordPress needs to access your web server
why i can’t install a new plugin on my wordpress? | DigitalOcean
ERROR: There was an error connecting to the server, Please verify the settings are correct. | DigitalOcean
Installing themes on wordpress requires FTP/SSH credentials | DigitalOcean
去给对应目录加上权限
plugins – to perform the requested action wordpress needs to access your web server. please enter your ftp – WordPress Development Stack Exchange
加配置就可以了?
plugins – What security concerns should I have when setting FS_METHOD to “direct” in wp-config? – WordPress Development Stack Exchange
好像原因是:
之前是通过FTP上传文件的-》FTP的文件,解压后,所有权也只是FTP用户的
而WordPress等服务,估计是另外的用户,所以没有权限操作
I cannot install plugins or themes from a local WordPress installation. (Ubuntu/XAMPP) Connection Information required | Treehouse Community
如果是给wp-config.php 加上:
define('FS_METHOD', 'direct');
是可以规避权限提示,但是有安全隐患
所以还是去加上命令去给操作权限:
[root@izj6cefkuu3496m71s907xz ~]# ll
total 237756
drwxr-xr-x 7 root root      4096 Aug 28 20:27 oneinstack
-rw-r--r-- 1 root root 243454613 Aug 21 11:22 oneinstack-full.tar.gz
[root@izj6cefkuu3496m71s907xz ~]# pwd
/root
[root@izj6cefkuu3496m71s907xz ~]# whoami
root
[root@izj6cefkuu3496m71s907xz ~]# cd /data/
mysql/   wwwlogs/ wwwroot/ 
[root@izj6cefkuu3496m71s907xz ~]# cd /data/wwwroot/
[root@izj6cefkuu3496m71s907xz wwwroot]# ll
total 12
drwxr-xr-x 3 www  www  4096 Aug 26 21:57 default
drwxr-xr-x 2 root root 4096 Aug 28 22:45 local_to_online
drwxr-xr-x 6 www  www  4096 Sep  1 14:53 
www.xxx.com
[root@izj6cefkuu3496m71s907xz wwwroot]# cd 
www.xxx.com/
[root@izj6cefkuu3496m71s907xz 
www.xxx.com
]# ll -h
total 200K
-rw-r--r--  1 root root  418 Sep 25  2013 index.php
-rw-r--r--  1 root root  20K Jan  7  2018 license.txt
-rw-r--r--  1 root root 7.3K Mar 19 00:13 readme.html
drwxr-xr-x  3 root root 4.0K Aug 28 22:57 tools
-rw-r--r--  1 root root 5.4K May  2 06:10 wp-activate.php
drwxr-xr-x  9 root root 4.0K Jul  6 00:06 wp-admin
-rw-r--r--  1 root root  364 Dec 19  2015 wp-blog-header.php
-rw-r--r--  1 root root 1.9K May  3 06:11 wp-comments-post.php
-rw-r--r--  1 root root 3.1K Aug 28 23:14 wp-config.php
-rw-r--r--  1 root root 2.8K Dec 16  2015 wp-config-sample.php
drwxr-xr-x  4 root root 4.0K Jul  6 00:06 wp-content
-rw-r--r--  1 root root 3.6K Aug 20  2017 wp-cron.php
drwxr-xr-x 18 root root  12K Jul  6 00:06 wp-includes
-rw-r--r--  1 root root 2.4K Nov 21  2016 wp-links-opml.php
-rw-r--r--  1 root root 3.3K Aug 22  2017 wp-load.php
-rw-r--r--  1 root root  37K May 11 05:05 wp-login.php
-rw-r--r--  1 root root 7.9K Jan 11  2017 wp-mail.php
-rw-r--r--  1 root root  16K Oct  4  2017 wp-settings.php
-rw-r--r--  1 root root  30K Apr 30 07:10 wp-signup.php
-rw-r--r--  1 root root 4.6K Oct 24  2017 wp-trackback.php
-rw-r--r--  1 root root 3.0K Sep  1  2016 xmlrpc.php
[root@izj6cefkuu3496m71s907xz 
www.xxx.com
]# 
可见,此处是:
网站是www创建的,而对应的ftp上传的文件,是通过sftp,即SSH的账户,即root上传,然后通过SSH登录服务器用root解压并操作的,所以都是root
所以需要去改为属于www这个用户才对。
[root@izj6cefkuu3496m71s907xz wwwroot]# chown -Rf www:www /data/wwwroot/
www.xxx.com/
[root@izj6cefkuu3496m71s907xz wwwroot]# ll -lh
total 12K
drwxr-xr-x 3 www  www  4.0K Aug 26 21:57 default
drwxr-xr-x 2 root root 4.0K Aug 28 22:45 local_to_online
drwxr-xr-x 6 www  www  4.0K Sep  1 14:53 
www.xxx.com
[root@izj6cefkuu3496m71s907xz wwwroot]# cd 
www.xxx.com/
[root@izj6cefkuu3496m71s907xz 
www.xxx.com
]# ll -lh
total 200K
-rw-r--r--  1 www www  418 Sep 25  2013 index.php
-rw-r--r--  1 www www  20K Jan  7  2018 license.txt
-rw-r--r--  1 www www 7.3K Mar 19 00:13 readme.html
drwxr-xr-x  3 www www 4.0K Aug 28 22:57 tools
-rw-r--r--  1 www www 5.4K May  2 06:10 wp-activate.php
drwxr-xr-x  9 www www 4.0K Jul  6 00:06 wp-admin
-rw-r--r--  1 www www  364 Dec 19  2015 wp-blog-header.php
-rw-r--r--  1 www www 1.9K May  3 06:11 wp-comments-post.php
-rw-r--r--  1 www www 3.1K Aug 28 23:14 wp-config.php
-rw-r--r--  1 www www 2.8K Dec 16  2015 wp-config-sample.php
drwxr-xr-x  4 www www 4.0K Jul  6 00:06 wp-content
-rw-r--r--  1 www www 3.6K Aug 20  2017 wp-cron.php
drwxr-xr-x 18 www www  12K Jul  6 00:06 wp-includes
-rw-r--r--  1 www www 2.4K Nov 21  2016 wp-links-opml.php
-rw-r--r--  1 www www 3.3K Aug 22  2017 wp-load.php
-rw-r--r--  1 www www  37K May 11 05:05 wp-login.php
-rw-r--r--  1 www www 7.9K Jan 11  2017 wp-mail.php
-rw-r--r--  1 www www  16K Oct  4  2017 wp-settings.php
-rw-r--r--  1 www www  30K Apr 30 07:10 wp-signup.php
-rw-r--r--  1 www www 4.6K Oct 24  2017 wp-trackback.php
-rw-r--r--  1 www www 3.0K Sep  1  2016 xmlrpc.php
[root@izj6cefkuu3496m71s907xz 
www.xxx.com
]# ll wp-c
wp-comments-post.php  wp-config.php         wp-config-sample.php  wp-content/           wp-cron.php           
[root@izj6cefkuu3496m71s907xz 
www.xxx.com
]# ll wp-content/
total 12
-rw-r--r-- 1 www www   28 Jan  9  2012 index.php
drwxr-xr-x 3 www www 4096 Jul  6 00:06 plugins
drwxr-xr-x 5 www www 4096 Jul  6 00:06 themes
[root@izj6cefkuu3496m71s907xz 
www.xxx.com
]# 
然后再去更新插件,也就可以正常通过www这个账号去操作,对于WordPress网站下面的文件就有权限了:
【总结】
此处,OneinStack安装出来的环境,以及vhost添加出来的虚拟主机,域名对应的路径是:
/data/wwwroot/www.xxx.com/
而默认的用户和组都是www:
[root@izj6cefkuu3496m71s907xz wwwroot]# ll
drwxr-xr-x 6 www  www  4096 Sep  1 14:53 www.xxx.com
然后后期通过SSH(的ftp上传文件,以及)解压WordPress文件,操作WordPress文件到此目录下,文件的所有者是root
-》而WordPress内部安装插件,是需要操作:
/data/wwwroot/www.xxx.com/
下面的wp-content等目录的,所以没有权限
解决办法是:
给www赋予www.xxx.com的所有权限
操作是:
chown -Rf www:www /data/wwwroot/www.xxx.com/
即可。

转载请注明:在路上 » 【已解决】WordPress安装升级或安装插件提示:To perform the requested action, WordPress needs to access your web server

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
16 queries in 0.082 seconds, using 9.41MB memory