2024年7月27日 星期六
通知

PHP安装Xcache加速模块

我使用的阿里云一键安装包sh-1.5.5 , 默认用的是ZendGuardLoader加速模块,我们要切换到xcache。

阿里云sh-1.5.5   下载地址

Xcache 3.2.0  下载地址

1、安装xcache

root# cd /sh-1.5.5 #进入软件包存放目录
root# wget http://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.gz #下载
root# tar zxvf xcache-3.2.0.tar.gz #解压
root# cd xcache-3.2.0 #进入安装目录
root# /alidata/server/php/bin/phpize #用phpize生成configure配置文件
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
root# ./configure --enable-xcache--enable-xcache-coverager --enable-xcache-optimizer --with-php-config=/alidata/server/php/bin/php-config #配置
root# make #编译
root# make install #安装
安装完成之后,出现下面的界面,记住以下路径,后面会用到。
Installing shared extensions: /alidata/server/php/lib/php/extensions/no-debug-non-zts-20121212/ #xcache模块路径

2、创建xcache缓存文件

root# touch /tmp/xcache #创建文件
root# chmod 777 /tmp/xcache #设置权限

3、创建xcache管理员密码为123456

root# echo -n "123456" | md5sum #记住类似下面一行代码(md5加密之后的密码),后面会用到
root# e10adc3949ba59abbe56e057f20f883e

4、拷贝xcache后台管理程序到网站根目录

root# cp -r /sh-1.5.5/xcache-3.2.0/htdocs/ /alidata/www/site1/xcache
root# chown www.www -R /alidata/www/site1/

5、配置php支持xcache

root# vi /alidata/server/php-5.5.7/etc/php.ini #编辑配置文件,在最后一行添加以下内容
[xcache-common]
extension = xcache.so
[xcache.admin]
xcache.admin.enable_auth = On
xcache.admin.user = "xcache"
xcache.admin.pass = "e10adc3949ba59abbe56e057f20f883e"
[xcache]
xcache.shm_scheme ="mmap"
xcache.size=60M
xcache.count =1
xcache.slots =8K
xcache.ttl=0
xcache.gc_interval =0
xcache.var_size=64M
xcache.var_count =1
xcache.var_slots =8K
xcache.var_ttl=0
xcache.var_maxttl=0
xcache.var_gc_interval =300
xcache.test =Off
xcache.readonly_protection = On
xcache.mmap_path ="/tmp/xcache"
xcache.coredump_directory =""
xcache.cacher =On
xcache.stat=On
xcache.optimizer =Off
[xcache.coverager]
xcache.coverager =On
xcache.coveragedump_directory =""

然后把ZendGuardLoader加速模块注释了,怕和Xcache冲突
#extension=memcache.so
#zend_extension=/alidata/server/php/lib/php/extensions/no-debug-non-zts-20121212/ZendGuardLoader.so
#zend_loader.enable=1
#zend_loader.disable_licensing=0
#zend_loader.obfuscation_level_support=3
#zend_loader.license_path=

:wq! #最后保存退出

6、测试

root# service php-fpm restart #重启php-fpm
root# service nginx restart #重启nginx

浏览器打开网站根目录下面的xcache
输入用户名xcache 密码123456

看到如下图

2018031609081447.png

原创文章,转载请注明: 转载自荣耀博客
本文链接地址: PHP安装Xcache加速模块

关于 荣耀博客

好记性,不如烂笔头。

随机推荐

2018031606503336 310x165.jpg

service nginx does not support chkconfig

#chkconfig --ad …

发表回复