安装所要软件
wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
wget http://pecl.php.net/get/memcached-1.0.2.tgz
memcached的官方网站 http://www.memcached.org/
安装libmemcached
tar zxvf libmemcached-0.42.tar.gz
cd libmemcached-0.42
./configure –-prefix=/usr/local/libmemcached –-with-memcached
make && make install
安装要注意的问题:
1, 安装过程中不要忘了,–with-memcached,不然会提示你
checking for memcached… no
configure: error: “could not find memcached binary”
2,你的memcached是不是1.2.4以上的,如果不是会提示你
clients/ms_thread.o: In function `ms_setup_thread’:
/home/zhangy/libmemcached-0.42/clients/ms_thread.c:225: undefined reference to `__sync_fetch_and_add_4′
clients/ms_thread.o:/home/zhangy/libmemcached-0.42/clients/ms_thread.c:196: more undefined references to `__sync_fetch_and_add_4′ follow
collect2: ld returned 1 exit status
make[2]: *** [clients/memslap] Error 1
make[2]: Leaving directory `/home/zhangy/libmemcached-0.42′
解决办法是–disable-64bit CFLAGS=”-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的安装
tar zxvf memcached-1.0.2.tar.gz
cd memcached-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 && make install
vi /usr/local/php/lib/php.ini
加上extension=memcached.so重起一下服务就可以了。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。