安裝所要軟件
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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。