“Smarty:无法在第44行的smarty_internal_write_file.php上写文件./templates_c/”

时间:2014-03-09 15:47:46

标签: php wordpress permissions relative-path smarty3

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

  

PHP致命错误:未捕获 - > Smarty:无法写文件   ./templates_c/wrt531ad24297cbc2.21519452< - \ n   /var/www/afric-edu/library/Smarty/sysplugins/smarty_internal_write_file.php   第44行

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

  

chmod -R 777 / library / Smarty

但没有结果...... 也许这与绝对和相对联系的历史有关?你知道吗?

感谢您的帮助

3 个答案:

答案 0 :(得分:1)

你是对的(差不多),这是许可问题。

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

答案 1 :(得分:0)

假设根文件夹为/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 :(得分:-2)

我在Cento 7中遇到类似的问题,我在/ etc / selinux / config中设置了SELINUX=disabled,它就像魅力一样。