在后台编写文章时,上传图片和上传到媒体库均报错。安装、更新插件提示需FTP账号和密码。Google了一下,是主机上文件夹和文件权限设置问题


解决方案:
查看Apache的配置文件,确认www文件夹下的用户和用户组分别是什么。我的都是默认Apache
[root@lhyweb conf]# vi httpd.conf
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User apache
Group apache
然后将Wordpress文件夹和其下面所有文件均设置755权限,并将权限给到Apache,然后重启Apache,问题即解决
[root@lhyweb www]# chmod -R 755 wordpress
[root@lhyweb www]# ls -l
total 12156
drwxr-xr-x 2 root root 6 Dec 24 04:47 cgi-bin
drwxr-xr-x 2 root root 6 Dec 24 04:47 html
-rw-r--r-- 1 root root 12442823 Apr 2 14:23 latest-zh_CN.tar.gz
drwxr-xr-x 5 1006 1006 4096 Apr 2 14:34 wordpress
[root@lhyweb www]# chown -R apache wordpress
[root@lhyweb www]# ls -l
total 12156
drwxr-xr-x 2 root root 6 Dec 24 04:47 cgi-bin
drwxr-xr-x 2 root root 6 Dec 24 04:47 html
-rw-r--r-- 1 root root 12442823 Apr 2 14:23 latest-zh_CN.tar.gz
drwxr-xr-x 5 apache 1006 4096 Apr 2 14:34 wordpress
[root@lhyweb www]# systemctl restart httpd