I'm running a VPS environment with PHP 5.3.27. Installed and configured Zend Opcache but it's not actually caching anything. The only file it is caching is the Opcache monitor.
0% memory usage
0% hit rate
total memory: 128.000MB
used memory: 276.266KB
free memory: 127.730MB
wasted memory: 0.000 bytes (0%)
number of cached files: 1
number of hits: 0
number of misses: 1
blacklist misses: 0
number of cached keys: 1
max cached keys: 7,963
Here's the config (PHP -v):
PHP 5.3.27 (cli) (built: Jan 25 2014 16:33:43)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
with the ionCube PHP Loader v4.4.1, Copyright (c) 2002-2013, by ionCube Ltd., and
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies
Zend OPcache (phpinfo)
> Opcode Caching Up and Running Optimization Enabled Startup OK Shared
> memory model mmap Cache hits 0 Cache misses 1 Used memory 225752 Free
> memory 133991976 Wasted memory 0 Cached scripts 1 Cached keys 1 Max
> keys 7963 OOM restarts 0 Hash keys restarts 0 Manual restarts 0
>
> Directive Local Value Master Value opcache.blacklist_filename no
> value no value opcache.consistency_checks 0 0 opcache.dups_fix Off Off
> opcache.enable On On opcache.enable_cli On On
> opcache.enable_file_override Off Off opcache.error_log no value no
> value opcache.fast_shutdown 1 1 opcache.file_update_protection 2 2
> opcache.force_restart_timeout 180 180 opcache.inherited_hack On On
> opcache.load_comments 1 1 opcache.log_verbosity_level 1 1
> opcache.max_accelerated_files 4000 4000 opcache.max_file_size 0 0
> opcache.max_wasted_percentage 5 5 opcache.memory_consumption 128 128
> opcache.optimization_level 0xFFFFFFFF 0xFFFFFFFF
> opcache.preferred_memory_model no value no value
> opcache.protect_memory 0 0 opcache.restrict_api no value no value
> opcache.revalidate_freq 60 60 opcache.revalidate_path Off Off
> opcache.save_comments 1 1 opcache.use_cwd On On
> opcache.validate_timestamps On On
There is something rare in :
number of cached files: 1
number of hits: 0
number of misses: 1
It says that you are cached only 1 file. May be PHP had restarted at some point or it is creating different proccess
I used to experience this situation. I tried to restart php-fpm and opcache worked again.