在将我的Xubuntu从13.04升级到13.10之后,我的Smarty和PHP出现了问题。
基本上,Smarty模板是在我编辑模板后5-7秒延迟重新编译的。
我比较了系统时间(date)和PHP的date(...),时间戳是相等的。
PHP Version 5.5.3-1ubuntu2
怎么修呢?
示例代码:
require_once 'classes/Smarty-3.1.8/libs/Smarty.class.php';
$tpl = new Smarty();
// if I edit this template, changes shows up after
// 3-4 seconds which is very annoying
// there was no issue in xubuntu 13.04 / older php version!
$tpl->display('test.tpl'); 编辑:
我反复检查了filemtime是否正常工作,而且确实如此。
发布于 2014-10-30 09:38:12
您可以保持opcache启用并设置:
opcache.revalidate_freq=0问题是,默认情况下,opcache只在2秒后检查时间戳,而智能编译模板是在同一请求期间生成的,因此不进行检查。
将opcache revalidate_freq设置为0使opcache每次检查所有文件的时间戳,因此.tpl文件中所做的更改立即显示。
编辑:我认为这在Smarty v3.1.29中已经不再必要了
发布于 2013-10-22 14:39:49
我找到了解决办法。
Acctionaly在Xubuntu13.10提供的最新PHP中默认启用了zend,这导致了问题。
我必须更改php的配置:
opcache.enable=0现在一切都很好,模板在编辑后立即编译。
https://stackoverflow.com/questions/19497125
复制相似问题