【问题标题】:Drupal - The directory sites/default/files exists but is not writable and could not be made writableDrupal - 目录sites/default/files 存在但不可写且不能写
【发布时间】:2015-04-13 10:13:11
【问题描述】:

当我尝试在 管理 > 配置 > 媒体 > 文件系统中添加“公共文件系统路径”和“私有文件系统路径”时 在我的 drupal 站点中,我收到“目录站点/默认/文件存在但不可写且无法写入”错误。但它在 localhost 中运行良好。

文件夹的权限是755,我改成777了,还是不行。

我还使用以下一些博客更改了所有者: chown -R apache:apache 私有

但它也没有帮助。

请帮忙。 提前致谢。

【问题讨论】:

  • 使用“chmod -R 777”命令赋予默认文件夹写入权限。如果您不是超级用户,请附加 sudo 关键字
  • @ViswanathPolaki 是的,我做到了,但没有运气。
  • 你的操作系统是什么ubuntu,windows什么的
  • 试试这个命令 chmod a+w sites/default 来源:digitalocean.com/community/tutorials/…
  • 嗨,试试这个命令 chown -R apache:apache /var/www/html/drupal 来源:howtoforge.com/centos-7-drupal-installation

标签: drupal drupal-7 file-permissions file-ownership


【解决方案1】:

尝试将sites/default/files中的.htaccess替换为原来的或者

尝试删除站点/默认/文件中的 .htaccess 或

尝试更改站点/默认/文件中的 .htaccess Options None Options +FollowSymLinks #Options None #Options +FollowSymLinks

您可以尝试在 Drupal 根目录中使用 .htaccess

【讨论】:

  • 添加 # 不幸的是没有帮助我
【解决方案2】:

可能您需要在目录上运行 restorecon 例如:

restorecon -rv default/

【讨论】:

    【解决方案3】:

    chmod -R 777 站点/默认/文件/

    ^ 为我工作,但是我没有私有文件系统路径。

    【讨论】:

      【解决方案4】:

      这个答案我太迟了,但可能会帮助搜索它的人。

      如果启用了 SELinux 安全性并且文件/目录的上下文中没有“rw”,则无论授予哪个组、用户或 Unix 权限,它都将不可写。

      要查看这些“隐藏”设置:

      ls -laZ sites/default
      
      drwxr-sr-x. apache www unconfined_u:object_r:httpd_sys_content_t:s0 .
      drwxr-xr-x. apache www unconfined_u:object_r:httpd_sys_content_t:s0 ..
      -rwxr-sr-x. apache www unconfined_u:object_r:httpd_sys_content_t:s0         default.settings.php
      drwxrwsr-x. apache www unconfined_u:object_r:httpd_sys_content_t:s0 files
      -rwxr-sr-x. apache www unconfined_u:object_r:httpd_sys_rw_content_t:s0 settings.php
      

      更改文件的设置/使其可写:

      sudo chcon -R -t httpd_sys_rw_content_t files
      

      安装完成后,使用与原始“http_sys_content_t”上下文相同的命令重置上下文。

      仅供参考 - 在“all”目录下安装主题时,此命令也是启用写入所必需的。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-12-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-03-24
        相关资源
        最近更新 更多