新建了一个discuz论坛,后台想开启内存优化,参考了各种意见后选择xcache作为优化工具。
折腾了半天才搞定。特此记录下,方便以后参考。
一、安装Xcache
# tar zxvf xcache-1.3.0.tar.gz
# cd xcache-1.3.0
# /usr/local/php/bin/phpize
# ./configure --enable-xcache --enable-xcache-coverager --enable-xcache-optimizer --with-php-config=/usr/bin/php-config
# make && make install
--enable-xcache 表示启用Xcache支持;
--enable-xcache-coverager 表示包含用于测量加速器功效的附加特性;
--enable-xcache-optimizer表示启用操作码优
extension = /usr/lib64/php/modules/xcache.so
[xcache.admin]
xcache.admin.enable_auth = On
xcache.admin.user = "admin"
; xcache.admin.pass = md5($your_password)
xcache.admin.pass = "e10adc3949ba59abbe56e057f20f883e"
[xcache]
xcache.shm_scheme = "mmap"
xcache.mmap_path = "/tmp/xcache"
xcache.readonly_protection = Off
xcache.size = 64M
xcache.count = 1
xcache.slots = 8k
xcache.ttl = 3600
xcache.gc_interval = 300
xcache.test = Off
xcache.readonly_protection = On
xcache.coredump_directory =""
xcache.cacher = On
xcache.stat = On
xcache.optimizer =Off
xcache.var_size = 4M
xcache.var_count = 1
xcache.var_slots = 8k
xcache.var_gc_interval = 300
xcache.var_ttl = 0
xcache.var_maxttl = 0
[xcache.coverager]
xcache.coverager =On
xcache.coveragedump_directory =""