php5.3.28安装加速缓存xcache
刚刚把eAccelerator换成APC也坚持不了多久,运行了一天就完蛋了, php 502错误,php-fpm卡住罢工!当php-fpm进程异常退出的时候其他进程无法获取 apc 的互斥锁。导致死锁。这次继续搜索apc资料,有人提到惠新宸(apc维护者之一)他建议不要再使用apc,建议换
刚刚把eAccelerator换成APC也坚持不了多久,运行了一天就完蛋了,php502错误,php-fpm卡住罢工!当php-fpm进程异常退出的时候其他进程无法获取apc的互斥锁。导致死锁。这次继续搜索apc资料,有人提到惠新宸(apc维护者之一)他建议不要再使用apc,建议换成opcache,php5.3用不了哈。
这次试试国产xcache
wget -c http://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.gz
tar zxvf xcache-3.2.0.tar.gz
cd xcache-3.2.0
/usr/local/php/bin/phpize
./configure –enable-xcache –enable-xcache-coverager –enable-xcache-optimizer –with-php-config=/usr/local/php/bin/php-config
make
make install
安装成功后,在php.ini配置文件尾部里面加入以下
xcache.admin.pass这里的管理密码需要32位的,随便找个网站生成下。
xcache.count 这里是cpu几核
;xcache
[xcache-common]
extension = xcache.so
[xcache.admin]
xcache.admin.enable_auth = On
xcache.admin.user = “admin”
;run: echo -n “yourpassword” |md5sum |awk ‘{print $1}’ to get md5 password
xcache.admin.pass = “c8e1118e1e8429ebabc79b3d910cb7a0″
[xcache]
xcache.shm_scheme =??????? “mmap”
xcache.size? =?????????????? 128M
; set to cpu count (cat /proc/cpuinfo |grep -c processor)
xcache.count =???????????????? 8
xcache.slots =??????????????? 8K
xcache.ttl?? =???????????????? 0
xcache.gc_interval =?????????? 0
xcache.var_size? =??????????? 4M
xcache.var_count =???????????? 1
xcache.var_slots =??????????? 8K
xcache.var_ttl?? =???????????? 0
xcache.var_maxttl?? =????????? 0
xcache.var_gc_interval =???? 300
xcache.readonly_protection = Off
; for *nix, xcache.mmap_path is a file path, not directory. (auto create/overwrite)
; Use something like “/tmp/xcache” instead of “/dev/*” if you want to turn on ReadonlyProtection
; different process group of php won’t share the same /tmp/xcache
xcache.mmap_path =??? “/dev/zero”
xcache.coredump_directory =?? “”
xcache.experimental =??????? Off
xcache.cacher =?????????????? On
xcache.stat?? =?????????????? On
xcache.optimizer =?????????? Off
[xcache.coverager]
; enabling this feature will impact performance
; enable only if xcache.coverager == On && xcache.coveragedump_directory == “non-empty-value”
; enable coverage data collecting and xcache_coverager_start/stop/get/clean() functions
xcache.coverager =????????? Off
xcache.coveragedump_directory = “”
;xcache end
重启php即可,输出echo phpinfo(); 查看是否成功!
这时候需要运行管理它,在xcache-3.2.0目录下的htdocs管理代码目录拷贝到可以运行的虚拟主机下,直接运行即可。
其它配置的详细解说看xcache.lighttpd.net
有问题请留言^_^
原文地址:php5.3.28安装加速缓存xcache, 感谢原作者分享。
推荐阅读