smarty找不到/ home上的目录

时间:2013-12-03 11:25:59

标签: php smarty

我已经/usr/local/lib/php/Smarty/Smarty.class.php了,我已将我的Smarty模板,缓存和其他目录放在/home/groucho/Code/PHP/smarty/中。

这是index.php中的/var/www/sapienter文件(这是我的应用文件夹):

<?php
// put full path to Smarty.class.php
require('/usr/local/lib/php/Smarty/Smarty.class.php');
$smarty = new Smarty();

$smarty->setTemplateDir('/home/groucho/Code/PHP/smarty/templates');
$smarty->setCompileDir('/home/groucho/Code/PHP/smarty/templates_c');
$smarty->setCacheDir('/home/groucho/Code/PHP/smarty/cache');
$smarty->setConfigDir('/home/groucho/Code/PHP/smarty/configs');

$smarty->testInstall();


$smarty->assign('name', 'Ned');
$smarty->display('index.tpl');

?>

但是这不起作用,因为它给了我这个输出:

Smarty Installation test...
Testing template directory...
FAILED: /home/groucho/Code/PHP/smarty/templates/ does not exist.
Testing compile directory...
FAILED: /home/groucho/Code/PHP/smarty/templates_c/ does not exist.
Testing plugins directory...
/usr/local/lib/php/Smarty/plugins is OK.
Testing cache directory...
FAILED: /home/groucho/Code/PHP/smarty/cache/ does not exist.
Testing configs directory...
FAILED: /home/groucho/Code/PHP/smarty/configs/ does not exist.
Testing sysplugin files...
... OK
Testing plugin files...
... OK
Tests complete.


Fatal error: Uncaught --> Smarty: Unable to load template file 'index.tpl' <-- thrown in /usr/local/lib/php/Smarty/sysplugins/smarty_internal_templatebase.php on line 127

/home/groucho/Code/PHP/smarty文件夹权限由chmod -R 775设置,我是所有者。

如果我将templates文件夹和其他文件夹直接放在/var/www/sapienter中并且我写了

$smarty->setTemplateDir('/var/www/sapienter/templates');

它有效。

为什么?为什么/var路径有效且/home没有?

0 个答案:

没有答案