【问题标题】:"Smarty: unable to write file ./templates_c/" on smarty_internal_write_file.php on line 44第 44 行 smarty_internal_write_file.php 上的“Smarty:无法写入文件 ./templates_c/”
【发布时间】:2014-03-09 15:47:46
【问题描述】:

我正在尝试在 wordpress 上实现 Smarty 模板,我遇到了这个问题:

PHP 致命错误:未捕获 --> Smarty:无法写入文件 ./templates_c/wrt531ad24297cbc2.21519452

我首先想到了权限问题,我尝试了这个:

chmod -R 777 /library/Smarty

但没有结果... 也许这与绝对和相对联系的历史有关?你有什么想法吗?

感谢您的帮助

【问题讨论】:

    标签: php wordpress permissions relative-path smarty3


    【解决方案1】:

    假设根目录是/var/www/html/,下面的SELinux命令会解决这个问题

    # semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/ow_smarty/templates_c(/.*)?"
    # restorecon -Rv /var/www/html/
    

    【讨论】:

      【解决方案2】:

      你是对的(几乎),这是权限问题。

      在您的情况下,您需要允许 Smarty 写入存储已编译模板 ./templates_c/ 的目录。

      【讨论】:

        【解决方案3】:

        首先检查你的 Smarty 类中的 templates_c 文件夹是否存在以及 $this->setCompileDir() 的路径。然后给 Smarty 权限:chmod -R 777 templates_c

        【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-02-29
        • 2012-11-25
        • 2017-10-14
        • 1970-01-01
        • 2021-09-24
        • 2020-09-07
        • 2012-03-31
        • 1970-01-01
        相关资源
        最近更新 更多