我在Linode
下的主机运行的是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
根目录地址,运行命令。这样一来再更新,就不会出错了。
以上解决方案根据
https://www.tipsandtricks-hq.com/how-to-fix-the-unable-to-create-directory-error-in-wordpress-5264
实验所得
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