标签:memcached
一:Memcached安装
1)安装扩展源:
yum install -y epel-release
2)安装相关组件:
yum install -y libevent memcached libmemcached
3)启动mamcached服务:
/etc/init.d/memcached start
查看是否启动成功:
二:PHP连接Memcached
1)先安装php的memcache扩展
wget http://www.apelearn.com/bbs/data/attachment/forum/memcache-2.2.3.tgz
# tar zxfmemcache-2.2.3.tgz
# cdmemcache-2.2.3
# /usr/bin/phpize //yum安装的php默认会在/usr/bin/phpize下
# ./configure --with-php-config=/usr/bin/php-config //此处路径由具体情况而定
# make && make install
//显示installing shared extensions 表明安装成功,后面的路径下会有一个memcache.so文件,可以自己ls看一下
2)把后面这个路径记住,然后修改php.ini,把extension_dir= "./" 修改为
extension_dir= " /usr/lib/php/modules/ "
并且添加一行:
extension="memcache.so"
3)PHP连接Memcached检验
/usr/bin/php -m |grep memcache
4)下载测试php脚本
curl www.apelearn.com/study_v2/.memcache.txt > 1.php 2>/dev/null
/usr/bin/php 1.php
标签:memcached
原文地址:http://11101179.blog.51cto.com/11091179/1758987