刚开始尝试pecl install zookeeper,结果发现找不到zookeeper依赖。网上的编译安装都是基于zookeeper-3.4.12.tar.gz,但是现在zookeeper稳定版本已经是apache-zookeeper-3.5.8,最新版本已经到了3.6,找不到旧的安装包了,新版安装方式有点不一样,在此分享出来给有需要的朋友。
一、安装依赖(已Centos为例)
yum install libtool ant
- 1
一般系统已经自带automake、autoconf,如果没有也要安装。
二、安装Cppunit测试库
1.下载安装包
wget https://nchc.dl.sourceforge.net/project/cppunit/cppunit/1.12.1/cppunit-1.12.1.tar.gz
- 1
2.解压安装包
tar -zxvf cppunit-1.12.1.tar.gz
- 1
3.进入目录
cd cppunit-1.12.1
- 1
4.configure
./configure
- 1
5.安装
make && make install
- 1
三、安装zookeeper-client
1.下载zookeeper包
wget http://mirror.bit.edu.cn/apache/zookeeper/stable/apache-zookeeper-3.5.8.tar.gz
- 1
2.解压
tar -xf apache-zookeeper-3.5.8.tar.gz
- 1
3.进入根目录
cd apache-zookeeper-3.5.8
- 1
4.编译compile_jute
ant compile_jute
- 1
5.进入client目录
cd zookeeper-client/zookeeper-client-c
- 1
6.autoreconf
ACLOCAL="aclocal -I /usr/local/share/aclocal" autoreconf -if
- 1
7.配置安装目录
./configure --prefix=/usr/local/zookeeper
- 1
8.安装
make && make install
- 1
四、安装PHP zookeeper扩展
wget http://pecl.php.net/get/zookeeper-0.6.4.tgz
- 1
tar zxvf zookeeper-0.6.4.tgz
- 1
cd zookeeper-0.6.4
- 1
phpize
- 1
./configure -with-libzookeeper-dir=/usr/local/zookeeper
- 1
make && make install
- 1
五、开启扩展配置
最后往php.ini里面添加
extension=zookeeper.so
- 1
</div><div><div></div></div>
<link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-e0530931f4.css" rel="stylesheet">
</div>
</article>