我已经安装了Symfony 2并且我已经激活了 opcache (ZendOPtimizer)扩展,当我打算生成网页的缓存时出现了这个错误:
Warning: filemtime(): stat failed for C:/Apache24/htdocs/symfony/app/cache/dev/annotations/Acme-DemoBundle-Controller-SecuredController.cache.php in C:\Apache24\htdocs\symfony\vendor\doctrine\common\lib\Doctrine\Common\Annotations\FileCacheReader.php line 97
这是我的 opcache 配置:
zend_extension="c:\php\ext\php_opcache.dll"
opcache.enable=1
opcache.use_cwd=0
opcache.validate_timestamps=0 ; file stat
opcache.revalidate_freq=2 ; seconds
opcache.revalidate_path=0
opcache.save_comments=0
opcache.load_comments=0
opcache.dups_fix=0
opcache.inherited_hack=0
opcache.log_verbosity_level=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.enable_file_override=1
opcache.max_wasted_percentage=5 ; percent waste until restart
opcache.consistency_checks=0
opcache.force_restart_timeout=180
opcache.blacklist_filename=paypal.php
opcache.fast_shutdown=1
opcache.optimization_level=0xffffffff
opcache.enable_slow_optimizations=1
opcache.max_file_size=0
当我禁用此扩展时,缓存的生成工作
版本:
答案 0 :(得分:4)
我的Mac上使用自制的php55版本出现了完全相同的问题。 如优化器文档中所述,选项opcache.enable_file_override = 1可能会破坏某些框架。 Symfony2似乎就是这种情况。将值切换为0解决了问题。
答案 1 :(得分:0)
1 - 确保您已禁用APC或它会造成冲突。
2 - 确保在激活opcache后完全重启了apache。