PHP安装Xcache

XCache 是一个开源的 opcode 缓存器/优化器, 这意味着他能够提高您服务器上的 PHP 性能. 他通过把编译 PHP 后的数据缓冲到共享内存从而避免重复的编译过程, 能够直接使用缓冲区已编译的代码从而提高速度. 通常能够提高您的页面生成速率 2 到5 倍, 降低服务器负载.

安装并配置XCache PHP扩展插件
echo ‘export LC_ALL=C’>> /etc/profile
. /etc/profile
yum -y install perl-devel
cd /tools
tar xf xcache-3.2.0.tar.bz2
cd xcache-3.2.0
/application/php/bin/phpize
./configure --enable-xcache --enable-xcache-coverager --enable-xcache-optimizer --with-php-config=/application/php/bin/php-config
make
make install
ls /application/php5.3.27/lib/php/extensions/no-debug-non-zts-20090626/

创建缓存目录
touch /tmp/xcache
chown -R nginx.nginx /tmp/xcache

拷贝可视化管理页面到Nginx
cp -r /tools/xcache-3.2.0/htdocs /application/nginx/html/xcache
chown nginx.nginx -R /application/nginx/html/xcache

创建管理员密码
echo -n “123456” | md5sum #创建管理页面密码必须要用md5

vi /application/php/lib/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 = 256M
xcache.count = 2 #官方推荐为cpu的数量
xcache.slots = 8K
xcache.ttl = 86400
xcache.gc_interval = 3000 #回收时间间隔,单位秒
xcache.var_size = 64M
xcache.var_count = 1 #官方推荐为cpu的数量
xcache.var_slots = 8K
xcache.var_ttl = 0
xcache.var_maxttl = 0
xcache.var_gc_interval = 300
xcache.var_namespace_mode = 0
xcache.var_namespace = “”
xcache.test = Off
xcache.readonly_protection = Off
xcache.mmap_path = “/tmp/xcache”
xcache.coredump_directory = “”
xcache.disable_on_crash = Off
xcache.experimental = Off
xcache.cacher = On
xcache.stat = On
xcache.optimizer = Off
[xcache.coverager]
xcache.coverager = Off
xcache.coverager_autostart = On
xcache.coveragedump_directory = “” #持久化路径

状态页面
http://47.94.224.211/xcache/cacher/
用户名:xcache
密码 :123456

猜你喜欢

转载自blog.csdn.net/bjgaocp/article/details/87933232