Smarty - 'unable to write file… templates_c'. (smarty_internal_write_file.php:44) [closed]

倾然丶 夕夏残阳落幕 提交于 2019-12-07 09:44:34

问题


I'm using Smarty for the first time. It works fine on my laptop (MAMP) but when I try and run a basic template on my production server (Windows) I get this error message:

Fatal error: Uncaught exception 'SmartyException' with message 'unable to write file C:\Inetpub\vhosts\path\to\web\root\smarty\templates_c\wrt516e53290e2095.47946913' in C:\Inetpub\vhosts\path\to\web\root\smarty\libs\sysplugins\smarty_internal_write_file.php:44 Stack trace: 
#0 C:\Inetpub\vhosts\path\to\web\root\smarty\libs\sysplugins\smarty_internal_template.php(201): Smarty_Internal_Write_File::writeFile('C:\Inetpub\vhos...', '<?php /* Smarty...', Object(Smarty)) 
#1 C:\Inetpub\vhosts\path\to\web\root\smarty\libs\sysplugins\smarty_internal_templatebase.php(155): Smarty_Internal_Template->compileTemplateSource() 
#2 C:\Inetpub\vhosts\path\to\web\root\smarty\libs\sysplugins\smarty_internal_templatebase.php(374): Smarty_Internal_TemplateBase->fetch('test.tpl', NULL, NULL, NULL, true) 
#3 C:\Inetpub\vhosts\path\to\web\root\admin-new\admin.php(99): Smarty_Internal_TemplateBase->display('test.tpl') 
#4 {main} thrown in C:\Inetpub\vhosts\path\to\web\root\smarty\libs\sysplugins\smarty_internal_write_file.php on line 44

I thought this might be something to do with file permissions (not that I understand anything about how file permissions work on Windows), but when this line:

var_dump(is_writable('C:\Inetpub\vhosts\path\to\web\root\smarty\templates_c'))

prints out bool(true)

No idea where to go from here. Why isn't Smarty working?

来源:https://stackoverflow.com/questions/16054669/smarty-unable-to-write-file-templates-c-smarty-internal-write-file-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!