1

I have installed Symfony 2 and I have activated the opcache (ZendOPtimizer) extension and when I intent to generate the cache of a web page O've got this error :

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

This is my opcache config :

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

When I disable this extension, the generation of the cache works

Versions :

  • Symfony 2.3.3
  • PHP 5.5
  • Apache 2.4.6 For Windows
hakre
  • 193,403
  • 52
  • 435
  • 836
psylo66
  • 608
  • 11
  • 26
  • Try switching opcache.save_comments to 1 (and possibly load_comments too) since Symfony uses comment annotations. See the recommended settings [here](https://raw.github.com/zendtech/ZendOptimizerPlus/master/README). – solarc Dec 02 '13 at 13:33

2 Answers2

4

I had exactly the same problem on my Mac, using the homebrew php55 version. As mentioned in the Optimizer documentation, the option opcache.enable_file_override=1 may break some frameworks. It seems that is the case for Symfony2. Switching the value to 0 solved the problem.

Corey Adler
  • 15,897
  • 18
  • 66
  • 80
Martial
  • 41
  • 2
0

1 - Make sure you have disabled APC or it'll create conflicts.

2 - Make sure you've restarted apache entirely after activating opcache.

sf_tristanb
  • 8,725
  • 17
  • 74
  • 118