我已经在mac osx 2.0.3上安装了Xcache 10.7.3模块,将其配置添加到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 数据缓存
但是 Xcache 设置配置正确,正如你从 phpinfo() 中看到的那样
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
我也遇到了同样的问题,但通过更改xcache.mmap_path
的值使其正常工作
xcache.mmap_path = "/tmp/xcache"
为什么 phpinfo 中的xcache.mmap_path
值与配置文件中设置的值不同?