Smarty 提示权限问题。我为我正在处理的项目编写了一个小型 mvc 框架,我需要能够在每个 Controller 中呈现模板。我继续按照 Smarty 安装说明进行操作,并在我的“前端 Controller ”或将请求路由到应用程序其余部分的页面中设置所有配置选项。 testinstall 函数说一切都是正确的,但是当我尝试在我的 Controller 中呈现模板时,我最终得到了这个。
Warning: mkdir(): Permission denied in /var/www/HRTRL/includes/CallLog/lib/Smarty/libs/sysplugins/smarty_internal_write_file.php on line 28 Warning: rename(/tmp/wrt6piczo,./templates_c/73b1662b4c376f493278f9873564df03430a0b43.file.poopy.tpl.php): No such file or directory in /var/www/HRTRL/includes/CallLog/lib/Smarty/libs/sysplugins/smarty_internal_write_file.php on line 48 Warning: chmod(): No such file or directory in /var/www/HRTRL/includes/CallLog/lib/Smarty/libs/sysplugins/smarty_internal_write_file.php on line 50 Warning: include(./templates_c/73b1662b4c376f493278f9873564df03430a0b43.file.poopy.tpl.php): failed to open stream: No such file or directory in /var/www/HRTRL/includes/CallLog/lib/Smarty/libs/sysplugins/smarty_internal_template.php on line 423 Warning: include(): Failed opening './templates_c/73b1662b4c376f493278f9873564df03430a0b43.file.poopy.tpl.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/HRTRL/includes/CallLog/lib/Smarty/libs/sysplugins/smarty_internal_template.php on line 423
我已经独立测试了框架的其余部分,一切似乎都正常。我的“前端 Controller ”将请求正确路由到正确的 Controller ,而且我似乎能够很好地呈现常规 HTML。
此外,为了测试,我已将所有 Smarty 库文件夹以及其他所需目录更改为 777。我仍然收到相同的权限错误。
编辑
这些是我对所有必需的 smarty 文件夹使用的设置。
$smarty->setTemplateDir('lib/smarty/templates');
$smarty->setCompileDir('lib/smarty/templates_c');
$smarty->setCacheDir('lib/smarty/cache');
$smarty->setConfigDir('lib/smarty/configs');
最佳答案
适当的权限为我解决了这个问题:
chown -R www-data /var/www/HRTRL
关于php - Smarty权限问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4588641/