日期:2014-05-16  浏览次数:20726 次

linux 下安装memcached

whereis libevent

安装memcached服务需要libevent支持
#wget http://monkey.org/~provos/libevent-2.0.10-stable.tar.gz
#tar zxvf libevent-2.0.10-stable.tar.gz
#cd libevent-2.0.10-stable
#./configure --prefix=/usr/local/libevent
#make
#make install

安装memcached服务
#wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
#tar zxvf memcached-1.4.4.tar.gz
#cd memcached-1.4.4
#./configure --prefix=/usr/local/memcached -with-libevent=/usr/local/libevent
#make
#make install

启动memcached服务
/usr/local/memcached/bin/memcached -d -m 1024 -u root -l 127.0.0.1 -p 11211 -c 1024 -P /tmp/memcached1.pid

memcached服务安装完成了

安装PECL的memcache扩展
#wget http://pecl.php.net/get/memcache-2.2.6.tgz
#tar zxvf memcache-2.2.5.tgz
#cd memcache-2.2.5
#/usr/local/php/bin/phpize
#./configure --enable-memcache --with-php-config=/usr/local/php/bin/php-config
#make
#make install
安装完成后会返回memcache.so文件生成的路径 cp至php的extension路径下
在php.ini中添加如下内容:
extension=memcache.so

安装PECL的memcached的扩展
#wget http://download.tangent.org/libmemcached-0.48.tar.gz
#tar zxvf?libmemcached-0.48.tar.gz
#cd?libmemcached-0.48
#./configure --prefix=/usr/local/libmemcached?--with-memcached
#make
#make install

#wget?http://pecl.php.net/get/memcached-1.0.2.tgz
#tar zxvf memcached-1.0.2.tar.gz
#cd?memcached-1.0.2
#/usr/local/php/bin/phpize
#./configure --enable-memcached?--with-libmemcached-dir=/usr/local/libmemcached/?--with-php-config=/usr/local/php/bin/php-config
#make
#make install
安装完成后会返回memcached.so文件生成的路径 cp至php的extension路径下
在php.ini中添加如下内容:
extension=memcached.so

#/usr/local/php/bin/php -m | grep memcache
此时应该可以看到memcache和memcached两个扩展

重启apache后,web服务上面memcached就可以使用了。

?

?

参考资料:

#memcached

http://memcached.org/http://code.jellycan.com/memcached/
#Memcached安装和基本使用(windows)

http://www.cnblogs.com/netflu/archive/2010/03/12/1684305.html
#memcache简要安装步骤

http://kb.cnblogs.com/a/1575049/
#Memcached linux安装说明

http://kb.cnblogs.com/a/1501326/

?