memcache和memcached安装
首先要明確? memcache不是memcached
?
第一步安裝libevent
#wget? https://github.com/downloads/libevent/libevent/libevent-2.0.15-stable.tar.gz
#tar libevent-2.0.15-stable.tar.gz
#tar xzvf libevent-2.0.15-stable.tar.gz
#cd libevent-2.0.15-stable
#./configure --help
#whereis libevent
#./configure --prefix=/usr
#ls -al /usr/lib|grep libevent
#make
#make install
#ls -al /usr/lib|grep libevent
#ldconfig -v
#ldconfig
--------------------------------------------------------------------------------------------?
?
第二步安裝memcached
# wget http://memcached.googlecode.com/files/memcached-1.4.9.tar.gz
#tar xzvf memcached-1.4.9.tar.gz
#cd memcached-1.4.9
#./configure --help
#./configure --prefix=/usr/local/memcached --with-libevent=/usr
#make
#make install
#ls /usr/local/memcached/bin/memcached -lh
#netstat –ntlpu
#/usr/local/memcached/bin/memcached -d -m 100 -uroot -l 0.0.0.0 -p 11211 -c 512 -P /usr/local/memcached/memcached.pid
#netstat -ntlpu
-------------------------------------------------------------------------
memcached進(jìn)程的查看與結(jié)束
#ps aux|grep mem
#cat /usr/local/memcached/memcached.pid
#ps aux 也可以查進(jìn)程
殺死m(xù)emcached進(jìn)程
#kill?? 進(jìn)程id
---------------------------------------------------------------------------------
?
第三步 安裝php的memcached擴(kuò)展memcache
#wget http://pecl.php.net/get/memcache-2.2.6.tgz
#tar vxzf memcache-2.2.6.tgz
#cd memcache-2.2.6
#/usr/local/php/bin/phpize
#./configure –enable-memcache –with-php-config=/usr/local/php/bin/php-config –with-zlib-dir
或者
#./configure --enable-memcache --with-php-config=/usr/local/php/bin/php-config --with-zlib-dir=/usr
#make
#make install
?
/usr/local/php/lib/php.ini
php.ini添加
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
;extension=memcache.so
如果程序沒(méi)有dl("memcache.so");是要這里加的。
?
-----------------------------------------------------------------------
測(cè)試
Memcache環(huán)境測(cè)試:
運(yùn)行下面的php文件,如果有輸出This is a test!,就表示環(huán)境搭建成功。開(kāi)始領(lǐng)略Memcache的魅力把!
< ?php
$mem = new Memcache;
$mem->connect(”127.0.0.1″, 11211);
$mem->set(’key’, ‘This is a test!’, 0, 60);
$val = $mem->get(’key’);
echo $val;
?>
?--------------------------------------------------
連接Memcached
#telnet? ip?? 端口
狀態(tài)stats回車(chē)
退出quit回車(chē)
總結(jié)
以上是生活随笔為你收集整理的memcache和memcached安装的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 侏罗纪世界电影中的迅猛龙的力气有多大?
- 下一篇: 皮皮虾我们走是谁唱的啊?