您的位置:首页 > 数据库 > Memcache

Centos5.5 安装memcache

2015-08-21 20:13 661 查看
#下载libevent http://libevent.org/ #下载memcahced http://memcached.org/downloads
#安装libevent
shell>tar -zxvf libevent-2.0.21-stable.tar.gz
shell>cd libevent-2.0.21-stable
shell>./configure --prefix=/usr/local/libevent
shell>make && make install
#安装memcached
shell>tar -zxvf memcached-1.4.24.tar.gz
shell>cd memcached-1.4.24
shell>./configure --prefix=/usr/local/memcached \
--with-libevent=/usr/local/libevent
shell>make && make install
##可能报错(1)
#启动
shell>/usr/local/memcached/bin/memcached -p 11211 -m 64 -u nobody -d

#安装memcache 对php的扩展
#下载地址:http://pecl.php.net
shell>tar -zxvf memcache-2.2.7.tgz
shell>cd memcache-2.2.7
#根据当前的php版本动态的创建扩展的configure文件。
shell>/usr/local/php/bin/phpize --with-php-config=/usr/local/php/bin/php-config
#报错(2)
shell>./configure --with-php-config=/usr/local/php/bin/php-config
shell>make && make install

#复制生成库的路径:/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/
#打开php.ini,添加如下代码:
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/memcache.so

#memcached开机启动
echo "/usr/local/memcached/bin/memcached -p 11211 -m 64 -u nobody -d" >> /etc/rc.d/rc.sysinit

#(1)make编译报错(可能发生)
items.c:1141: 警告:由于数据类型范围限制,比较结果永远为真
因为Makefile有-Werror让警告也不通通过编译,修改Makefile把-Werror参数去掉就可以。
-Werror的意思是警告即错误,即编译过程中有警告产生就无法编译通过。
而memcached的源代码也许写得不够严谨,出警告了。

#(2)可能报错
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
运行/usr/local/webserver/php/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. Then, rerun this script.
根据网上的解决办法是:
方法一:
# cd /usr/src
# wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz # tar -zvxf m4-1.4.9.tar.gz
# cd m4-1.4.9/
# ./configure && make && make install
# cd ../
# wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.gz # tar -zvxf autoconf-2.62.tar.gz
# cd autoconf-2.62/
# ./configure && make && make install

方法二:
更简单的办法
# yum install m4
# yum install autoconf

方法三:
挂载centos光驱,进入Centos/
rpm -ivh m4-1.4.5-3.el5.1.i386.rpm
#此rpm包为autoconf的依赖包
rpm -ivh imake-1.0.2-3.i386.rpm
rpm -ivh autoconf-2.59-12.noarch.rpm
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: