Zend OpCache显示在phpinfo()但没有做任何事情

时间:2014-03-17 15:09:11

标签: php zend-framework

我正在使用PHP 5.3.27运行VPS环境。安装和配置Zend Opcache但它实际上没有缓存任何东西。缓存的唯一文件是Opcache监视器。

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

这是配置(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

2 个答案:

答案 0 :(得分:0)

有一些罕见的事情:

number of cached files: 1
number of hits: 0
number of misses: 1

它表示您只缓存了1个文件。可能是PHP已经在某个时候重新启动,或者它正在创建不同的进程

答案 1 :(得分:0)

我曾经遇到过这种情况。 我试图重启php-fpm并且opcache再次工作。