libevent:
# wget http://monkey.org/~provos/libevent-1.4.8-stable.tar.gz
memcached:
# wget http://www.danga.com/memcached/dist/memcached-1.2.6.tar.gz
安裝libevent,也可以加上prefix指定安裝位置
# tar -xzvf libevent-1.4.8-stable.tar.gz
# cd libevent-1.4.8-stable
# ./configure;make;make install;
安裝memcached
# tar -xzvf memcached-1.2.6.tar.gz # cd memcached-1.2.6 # ./configure --prefix=/home/memcached # make # make install
都安裝好了,接著檢查一下所有的libraries是不是 都載入了。
LD_DEBUG=libs /home/memcached/bin/memcached -v
通常會出現
memcached: error while loading shared libraries:libevent-1.4.so.2: cannot open shared object file: No such file or directory
memcached主要會在幾個路徑(錯誤訊息中會有)上找library,所以將libevent-1.4.so.2做link到該路徑
64位元
# ln -s /usr/local/lib/libevent-1.4.so.2 /lib64/libevent-1.4.so.2
32位元
# ln -s /usr/local/lib/libevent-1.4.so.2 /lib/libevent-1.4.so.2
接著啟動memcached,在127.0.0.1:11211,配置512mb的空間
# /home/memcached/bin/memcached -d -u root -m 512 127.0.0.1 -p 11211
[ 部落小波 說:這行可以放進 /etc/rc.d/boot.local, 這樣重開機就會自動帶起來了 ]
測試,看memcached有沒有在執行
# ps -aux | grep memcache
接著在php中安裝memcache套件
先下載memcache
# wget http://pecl.php.net/get/memcache-3.0.2.tgz
安裝
# tar -xzvf memcache-3.0.2.tgz
# cd memcache-3.0.2
# /home/php/bin/phpize
# ./configure --enable-memcache --with-php-config=/home/php/bin/php-config --with-zlib-dir
# make
# make install
PHP設定
# vi /home/php/lib/php.ini
[ Dynamic Extensions 下加入 ]
# extension=memcache.so
檢查結果
# /home/php/bin/php -i | grep -i 'memcache'
Done
0 comments:
張貼留言