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

14 篇文章 0 订阅
7 篇文章 0 订阅

我在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
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值