1.准备软件包
xcache-3.2.0.tar.gz
2.安装组件
$ echo 'export LC_ALL=C' >> /etc/profile
$ tail -l /etc/profile
$ source /etc/profile
$ yum -y install perl-CPAN
或 $ yum -y install perl-devel
3.安装xcache
$ tar xf xcache-3.2.0.tar.gz
$ cd xcache-3.2.0
$ /usr/local/php/bin/phpize
$ ./configure --enable-xcache --enable-xcache-optimizer --with-php-config=/usr/local/php/bin/php-config
$ make && make install
4.配置xcache
$ vi /usr/local/php/etc/php.ini
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/" extension = xcache.so
$ service httpd restart
$ cat xcache.ini >> /usr/local/php/etc/php.ini
几个关键的参数:
xcache.size = 128M ;缓存大小 xcache.count = 2 ;cpu数量 xcache.ttl = 86400 ;缓存生效时间 xcache.gc_interval = 3600 ;回收间隔 xcache.var_size = 0 ;变量大小
5.使用xcache
$ cp -r htdocs /usr/local/httpd/htdocs/xcache
$ vi /usr/local/php/etc/php.ini
$ echo -n "123456" | md5sum
e10adc3949ba59abbe56e057f20f883e -
##或者进入xcache官网生成一个md5的密码字符串
##http://xcache.lighttpd.net/demo/cacher/mkpassword.php
xcache.admin.user = "xcache" xcache.admin.pass = "e10adc3949ba59abbe56e057f20f883e"
$ service httpd restart
访问http://domain/xcache/
;