【问题标题】:File system is not writable文件系统不可写
【发布时间】:2023-03-09 11:20:02
【问题描述】:

我在一个网络主机上成功安装了 Drupal 7。 安装模块后,我收到一个错误错误,并且状态报告给了我这个错误消息:

File system Not writable
The directory /Applications/MAMP/tmp/php does not exist.
You may need to set the correct directory at the file system settings page or
change the current directory's permissions so that it is writable.

我检查了(sites/default/files) 的权限,它具有 755 权限,我将其更改为 777,但什么也没发生,所以我将其退回。

我对@9​​87654323@ 有以下设置

Public file system path
sites/default/files

Temporary directory
/Applications/MAMP/tmp/php

这是我得到的错误:

Warning: file_put_contents(temporary://fileDyFbDg) [function.file-put-contents]: failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (line 1898 of /home/imamus/public_html/includes/file.inc).
The file could not be created.
Warning: file_put_contents(temporary://fileeTFMpl) [function.file-put-contents]: failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (line 1898 of /home/imamus/public_html/includes/file.inc).
The file could not be created.
Warning: file_put_contents(temporary://fileuB8Tdu) [function.file-put-contents]: failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (line 1898 of /home/imamus/public_html/includes/file.inc).
The file could not be created.
Warning: file_put_contents(temporary://filea1KYXG) [function.file-put-contents]: failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (line 1898 of /home/imamus/public_html/includes/file.inc).
The file could not be created.

请指教。

【问题讨论】:

    标签: php drupal-7 filesystems file-permissions


    【解决方案1】:

    发生错误,因为您的临时目录不可被您的网络服务器用户写入。

    您可以在管理面板中查看 ReportsStatus report,地址为:/admin/reports/status

    要修复它,您必须在 Configuration 中的 File system/admin/config/media/file-system),然后更改您的 临时目录指向您的可写目录。如果这是正确的,那么让你设置正确的权限,例如

    sudo chmod -R 777 /Applications/MAMP/tmp/php
    

    默认文件夹也是如此:

    sudo chmod -R 777 sites/default/files
    

    冲刺

    如果您使用的是drush,请检查当前设置的文件夹:

    drush vget file_temporary_path
    

    然后修复它,尝试:

    drush vset file_temporary_path /tmp
    

    这里是默认的临时目录:

    • OS X:/private/tmp,对于 MAMP:/Applications/MAMP/tmp/php
    • Linux/Unix:/tmp

    【讨论】:

      【解决方案2】:

      此回复适用于非 Windows 网站:
      就我而言,sites/default/files/ 文件夹设置为 775(将其设置为 777 不是一个好主意)
      我不得不删除以下文件夹:

      rm -rf /tmp/devel_themer/
      

      然后它起作用了!

      【讨论】:

        【解决方案3】:

        我检查了 (sites/default/files) 的权限,它有 755 个权限,我将其更改为 777,但什么也没发生,所以我将其退回。

        /Applications/MAMP/tmp/php做同样的事情

        【讨论】:

        • 这是在哪里?我的网站不在本地托管。
        • 它是一个绝对路径,因此位于顶层(文件系统根目录),也就是“/”,然后是 Applications,然后是 MAMP,然后是 tmp,然后是 php。您可能希望将其更改为实际存在的内容并修复权限。 --- 当然一切都在服务器上。
        • 感谢您的帮助...我在文件系统根目录中创建了 /Applications/MAMP/tmp/php 但仍然出现错误我也在 /public_html 中创建了我的网站文件所在的位置但仍然得到同样的错误。
        • 你有shell访问服务器吗? ls -la /Applications/MAMP/tmp/php 说什么?
        • 您可能在与根目录不同的主目录(可能:/home/imamus)中创建了 pubic_html(始终:/)。你有没有可能创建/home/imamus/Applications/MAMP/tmp/php?请也为那个人做一个ls
        猜你喜欢
        • 1970-01-01
        • 2018-06-15
        • 1970-01-01
        • 2022-08-20
        • 1970-01-01
        • 1970-01-01
        • 2020-01-16
        • 2020-02-17
        • 1970-01-01
        相关资源
        最近更新 更多