【问题标题】:Why PHP can't write even with chmod 777 and SELinux disabled?为什么即使禁用 chmod 777 和 SELinux,PHP 也无法编写?
【发布时间】:2020-09-06 21:35:18
【问题描述】:

问题

PHP 无法写入文件。函数is_writable('/data')返回false

详情:

当我尝试安装 NextCloud 并将其数据目录设置为 /data 时,我遇到了 Can't create or write into the data directory 错误。跟着它,我发现is_writable($dataDir)失败了(/path/to/nextcloud/lib/private/setup.php线312

我已设置 chmod 777 -R /datachown -R www:www /data 并禁用 SELinux。

open_basedirphp.ini里面的问题,还是其他原因?

平台

  • CentOS 8
  • BT-Panel安装的带有php7.3的LNMP
    • nginx 1.61
    • php 7.3

【问题讨论】:

  • Apache 服务器用户是www-data。我不确定用户www。您使用的是哪个服务器?
  • @HarishST 我正在使用 nginx

标签: php chmod selinux nextcloud


【解决方案1】:

我自己解决了这个问题

php.ini 文件很多!请检查其中是否包含open_basedir。如果设置了open_basedir,则php写权限会受到限制。

阅读更多关于open_basedir

这是一个愚蠢的问题:(

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-06-25
    • 1970-01-01
    • 1970-01-01
    • 2017-07-18
    • 1970-01-01
    • 1970-01-01
    • 2013-08-12
    • 2019-10-10
    相关资源
    最近更新 更多