安装所要软件

wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz

wgethttp://pecl.php.net/get/memcached-1.0.2.tgz

memcached的官方网站http://www.memcached.org/

安装libmemcached

tarzxvflibmemcached-0.42.tar.gz
cdlibmemcached-0.42
./configure–-prefix=/usr/local/libmemcached–-with-memcached
make&&makeinstall

安装要注意的问题:

1,安装过程中不要忘了,–with-memcached,不然会提示你

checkingformemcached…no
configure:error:“couldnotfindmemcachedbinary”

2,你的memcached是不是1.2.4以上的,如果不是会提示你

clients/ms_thread.o:Infunction`ms_setup_thread’:
/home/zhangy/libmemcached-0.42/clients/ms_thread.c:225:undefinedreferenceto`__sync_fetch_and_add_4′
clients/ms_thread.o:/home/zhangy/libmemcached-0.42/clients/ms_thread.c:196:moreundefinedreferencesto`__sync_fetch_and_add_4′follow
collect2:ldreturned1exitstatus
make[2]:***[clients/memslap]Error1
make[2]:Leavingdirectory`/home/zhangy/libmemcached-0.42′

解决办法是–disable-64bitCFLAGS=”-O3-march=i686″,


最好的方法是换个版本的软件

https://launchpad.net/libmemcached/1.0/0.51/+download/libmemcached-0.51.tar.gz

./configure--prefix=/usr/local/libmemcached--with-memcached


如果不用这个64位的long型数据,我想php扩展memcached,memcache也就没什么区别了,装memcached也就没什么意思了。


php的扩展memcached的安装

tarzxvfmemcached-1.0.2.tar.gz
cdmemcached-1.0.2
/usr/local/php/bin/phpize

./configure--with-memcached-with-php-config=/usr/local/php/bin/php-config--with-libmemcached-dir=/usr/local/libmemcached--enable-memcached

make&&makeinstall

vi/usr/local/php/lib/php.ini

加上extension=memcached.so重起一下服务就可以了。