Can not write to cache files, please check directory (discuzx)



  • Can not write to cache files, please check directory ./data/ and ./data/sysdata/ .
    相信在discuzx 好多人遇到這問題, 即使把data, 和 /data/sysdata/ 設成777也無法解決, 網上暫時無人提出解決方法

    原因是CentOS7的SeLinux, 會block了 php的 fopen指令, 令你完全cache唔到

    只要把SELinux關閉就可以, 只需一句command:

    sudo setenforce 0
    

    這便立即關了SELinux, 但是開機後又會再開, 因此你可以修改開機文件:

    /etc/selinux/config

    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    #       enforcing - SELinux security policy is enforced.
    #       permissive - SELinux prints warnings instead of enforcing.
    #       disabled - No SELinux policy is loaded.
    SELINUX=disabled
    # SELINUXTYPE= can take one of these two values:
    #       targeted - Targeted processes are protected,
    #       mls - Multi Level Security protection.
    SELINUXTYPE=targeted
    

    SELINUX=disabled

    重新開機, 再check status

    sestatus
    

    SELinux status: disabled


Log in to reply