php - Smarty权限问题

标签 php templates smarty

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/

相关文章:

c++ - 具有一些非公共(public)部分的模板函数

C++:重新定义不同类型的模板类

php - 什么时候你才能称自己为 PHP 专业人士?

php - 使用 curl 进行身份验证

php - 无法连接 mysql 并出现套接字错误

c++ - 内置类型的模板参数默认值

smarty - 是否可以将变量放入配置文件中?

javascript - javascript中的smarty变量

php - jQuery 和 php 注册脚本不起作用

javascript - 两个引用类似功能的按钮不适用于 html 和 javascript ajax