###安装Memcache服务器端###
##libevent官网:
cd /opt/distfiles
wget -c
tar zxvf libevent-1.4.5-stable.tar.gz
cd libevent-1.4.5-stable
./configure --prefix=/usr/local/libevent
make && make install
##memcached官网:
cd /opt/distfiles
wget -c
tar zxvf memcached-1.2.5.tar.gz
cd memcached-1.2.5
./configure --prefix=/usr/local/memcache --with-libevent=/usr/local/libevent
make && make install
##启动memcached服务
/usr/local/memcache/bin/memcached -d -m 100 -u root -p 12000 -c 256 -P /tmp/memcached.pid
###注意:运行"/usr/local/memcache/bin/memcached "时有类似以下错误提示
/usr/local/memcache/bin/memcached : error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory
##64位系统解决办法:
ln -s /usr/local/libevent/lib/libevent-1.4.so.2 /usr/lib64/libevent-1.4.so.2
##32位系统解决办法:
ln -s /usr/local/libevent/lib/libevent-1.4.so.2 /usr/lib/libevent-1.4.so.2
###安装Memcache的PHP扩展###
##PECL官网:
cd /opt/distfiles
wget -c
tar zxvf memcache-2.2.3.tgz
cd memcache-2.2.3
/opt/modules/phpcgi/bin/phpize
##注意:如果运行后有以下错误提示,需要安装autoconf automake,apt-get install autoconf automake
/opt/modules/phpcgi/bin/phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF
environment variable is set correctly and then rerun this script.
./configure --enable-memcache --with-zlib-dir --with-php-config=/opt/modules/phpcgi/bin/php-config
make && make install
##配置php.ini
vi /opt/modules/phpcgi/lib/php.ini
将extension_dir = "./" 修改为 extension_dir = "/opt/modules/phpcgi/lib/php/extensions/no-debug-non-zts-20060613"
然后在下面添加:
extension="memcache.so"
##重起web服务查看info.php memcached是否加载
###memcachedb安装
wget -c
cd db-4.7.25/build_unix
../dist/configure
make && make install
#将Berkeley Db运行库的路径添加到系统配置里面
echo "/usr/local/BerkeleyDB.4.7/lib/" >> /etc/ld.so.conf
#重载系统Ld运行库
ldconfig
cd /opt/distfiles
wget -c
tar zxvf memcachedb-1.0.3.tar.gz
cd memcachedb-1.0.3
./configure --with-libevent=/usr/local/libevent --with-bdb=/usr/local/BerkeleyDB.4.7
阅读(1188) | 评论(0) | 转发(0) |