#########################php-memcache缓存加快命中率########################
rpm -qa |grep php
yum remove -y `rpm -qa|grep php`
tar zxf memcache-2.2.5.tgz
cd memcache-2.2.5
phpize ##php扩展安装memcache
./configure
make && make install
cd /usr/local/lnmp/php/etc/
vim php.ini
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
.............
871 extension=memcache.so
/etc/init.d/php-fpm reload
php -m |grep memcache
cd memcache-2.2.5
yum install -y memcached
/etc/init.d/memcached start
netstat -antlp |grep :11211
yum install -y telnet
telnet localhost 11211
将example.php和memcache.php放到web下,发布目录。
cp example.php /usr/local/lnmp/nginx/html/
cp memcache.php /usr/local/lnmp/nginx/html/
cd /usr/local/lnmp/nginx/html/
vim memcache.php
22 define('ADMIN_USERNAME','admin'); // Admin Username
23 define('ADMIN_PASSWORD','westos'); // Admin Password
28 $MEMCACHE_SERVERS[] = '127.0.0.1:11211'; // add more as an array
29 #$MEMCACHE_SERVERS[] = 'mymemcache-server2:11211'; // add more as anarray
访问:
172.25.90.1/memcache.php
如图九:
如图十:
访问:172.25.90.1/example.php