红联Linux门户
Linux帮助

Ubuntu+Apache环境下Wordpress更新失败无法创建文件夹的解决

发布时间:2017-08-11 09:31:02来源:blog.csdn.net/lgyaxx作者:求抱抱的喵
我在Linux下的主机运行的是Ubuntu 16.04 + apache2,在wordpress更新时出现无法创建文件夹的错误。
而更改wp-content的权限为775等办法并没有效果。注意:不要将你的文件夹权限改为777,因为这样一来会有很大的安全隐患。
 
这种情况下,我们需要将wordpress文件夹所属的用户更换为apache所属用户:
$ sudo chown -R www-data /var/www/path-to-your-wordpress-root
 
请将path-to-your-wordpress-root替换为你的wp根目录地址,运行命令。这样一来再更新,就不会出错了。
 
以上解决方案根据:
Ubuntu+Apache环境下Wordpress更新失败无法创建文件夹的解决
 
实验所得
The webserver (Apache) runs as user www-data and group www-data by default on a Ubuntu system. If the files/folders are not owned by this user (www-data) then the webserver will be unable to write changes to them.
Change the filesystem permission on the folder (where the web application wants to write to) to the “parent directory” as mentioned in the error message.
For example, do (prepend with sudo if you’re not the current owner and need to elevate your own permissions in order to do it):
chown www-data /path/to/directory 
to make www-data the owner which makes it writeable usually, or another approach via groups:
> chgrp www-data /path/to/directory 
> chmod g+w /path/to/directory
 
本文永久更新地址:http://www.linuxdiyf.com/linux/32283.html