1

我已经在 mac osx 10.7.3 上安装了 Xcache 2.0.0 模块,将它的配置添加到 php.ini 中,如下所示

; zend_extension = /opt/local/lib/php/extensions/no-debug-non-zts-20090626/xcache.so extension = xcache.so
[xcache]
xcache.shm_scheme =        "mmap"
xcache.size  =               64M
xcache.count =                 1
xcache.slots =                8K
xcache.ttl   =                 0
xcache.gc_interval =           0
xcache.var_size  =            32M
xcache.var_count =             1
xcache.var_slots =            8K
xcache.var_ttl   =             0
xcache.var_maxttl   =          0
xcache.var_gc_interval =     300

xcache.mmap_path =    "/dev/zero"
xcache.coredump_directory =   ""
; per request settings
xcache.cacher =               On
xcache.stat   =               On
xcache.optimizer =           Off    

xcache.test =                Off
xcache.experimental =        Off

[xcache.coverager]
xcache.coverager =          Off

; ini only settings xcache.coveragedump_directory = ""

当我尝试使用以下功能时放

$test = "Hello";
xcache_set("test", $test );

出现了这个错误

警告:xcache_set() [function.xcache-set]: xcache.var_size 为 0 或太小而无法启用 var 数据缓存

但是从 phpinfo() 可以看到,Xcache 设置配置正确

XCache Support  enabled
Version 2.0.0
Modules Built   cacher coverager
Readonly Protection N/A
Cache Init Time 2012-05-09 16:07:12
Cache Instance Id   4687
Opcode Cache    enabled, 67,108,864 bytes, 1 split(s), with 16384 slots each
Variable Cache  enabled, 33,554,432 bytes, 1 split(s), with 16384 slots each
Shared Memory Schemes   mmap
Coverage Auto Dumper    disabled

Directive   Local Value Master Value
xcache.admin.enable_auth    On  On
xcache.cacher   On  On
xcache.coredump_directory   no value    no value
xcache.count    1   1
xcache.coveragedump_directory   no value    no value
xcache.coverager    Off Off
xcache.experimental Off Off
xcache.gc_interval  0   0
xcache.mmap_path    /tmp/xcache /tmp/xcache
xcache.readonly_protection  0   0
xcache.shm_scheme   mmap    mmap
xcache.size 64M 64M
xcache.slots    16K 16K
xcache.stat On  On
xcache.test no value    no value
xcache.ttl  0   0
xcache.var_count    1   1
xcache.var_gc_interval  300 300
xcache.var_maxttl   0   0
xcache.var_size 32M 32M
xcache.var_slots    16K 16K
xcache.var_ttl  0   0
4

1 回答 1

4

我也遇到了同样的问题,但是通过更改xcache.mmap_path

xcache.mmap_path =    "/tmp/xcache"

为什么xcache.mmap_pathphpinfo中的值和你配置文件中设置的值不一样?

于 2012-06-14T05:54:05.543 回答