标签:php bzip 指定 nmp code 2.0 class release 变量
一、安装前提
(1) 安装好 LNMP 完整环境
(2) Nginx 能够解析 PHP
(3) 配置环境变量:echo ‘export LC_ALL=C‘ >> /etc/profile && source /etc/profile 2> /dev/null
(4) 安装 Perl 相关依赖:yum install -y perl-devel
(5) 注意:eAccelerator 、XCache 、ZendOpcache 都是缓存加速器,安装时只安装其中一个,首选 XCache
二、安装 XCache
cd /usr/local/src/ wget http://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.bz2 yum install -y bzip2 tar xf xcache-3.2.0.tar.bz2 cd xcache-3.2.0 /usr/local/php/bin/phpize ./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-config make && make install cd ..
三、配置 XCache
[root@localhost ~]# vim /usr/local/src/xcache-3.2.0/xcache.ini xcache.size = 256M # 缓存大小 xcache.count = 2 # 指定将缓存对象切分成多少块,根据CPU数量来修改 xcache.ttl = 86400 # 设置缓存对象的生存期 xcache.gc_interval = 3600 # 回收器扫描过期的对象回收内存空间的间隔,单位为秒 xcache.var_size = 64M # 用于变量缓存
[root@localhost ~]# vim /etc/sysctl.conf kernel.msgmnb = 65535 kernel.msgmax = 65535 kernel.shmmax = 68719476736 kernel.shmall = 4294967196
cat /usr/local/src/xcache-3.2.0/xcache.ini >> /usr/local/php/lib/php.ini pkill php-fpm /usr/local/php/sbin/php-fpm
[root@localhost ~]# /usr/local/php/bin/php -v # 检查加速情况 PHP 5.3.27 (cli) (built: May 5 2017 07:35:34) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies with XCache v3.2.0, Copyright (c) 2005-2014, by mOo with XCache Cacher v3.2.0, Copyright (c) 2005-2014, by mOo
四、配置图形界面查看 XCache 缓存加速信息
[root@localhost ~]# echo -n "123456" | md5sum e10adc3949ba59abbe56e057f20f883e -
[root@localhost ~]# vim /usr/local/php/lib/php.ini [xcache.admin] xcache.admin.enable_auth = On xcache.admin.user = "pzk" xcache.admin.pass = "e10adc3949ba59abbe56e057f20f883e" # 账号为 pzk,密码为上面生成的 123456
cd /usr/local/src/xcache-3.2.0 cp -a htdocs/ /usr/local/nginx/html/wordpress/xadmin # 红色部分修改为对应的网站目录 chown -R nginx.nginx /usr/local/nginx/html/wordpress/xadmin pkill php-fpm /usr/local/php/sbin/php-fpm
访问:www.wordpress.com/xadmin/index.php
标签:php bzip 指定 nmp code 2.0 class release 变量
原文地址:http://www.cnblogs.com/pzk7788/p/6907793.html