PHP安装zookeeper扩展(最新基于zookeeper-3.5.8)

刚开始尝试pecl install zookeeper,结果发现找不到zookeeper依赖。网上的编译安装都是基于zookeeper-3.4.12.tar.gz,但是现在zookeeper稳定版本已经是apache-zookeeper-3.5.8,最新版本已经到了3.6,找不到旧的安装包了,新版安装方式有点不一样,在此分享出来给有需要的朋友。

一、安装依赖(已Centos为例)

yum install libtool ant

一般系统已经自带automake、autoconf,如果没有也要安装。

二、安装Cppunit测试库

1.下载安装包

wget https://nchc.dl.sourceforge.net/project/cppunit/cppunit/1.12.1/cppunit-1.12.1.tar.gz

2.解压安装包

tar -zxvf cppunit-1.12.1.tar.gz

3.进入目录

cd cppunit-1.12.1

4.configure

./configure

5.安装

make && make install

三、安装zookeeper-client

1.下载zookeeper包

wget http://mirror.bit.edu.cn/apache/zookeeper/stable/apache-zookeeper-3.5.8.tar.gz 

2.解压

tar -xf apache-zookeeper-3.5.8.tar.gz

3.进入根目录

cd apache-zookeeper-3.5.8

4.编译compile_jute

ant compile_jute

5.进入client目录

cd zookeeper-client/zookeeper-client-c

6.autoreconf

ACLOCAL="aclocal -I /usr/local/share/aclocal" autoreconf -if

7.配置安装目录

./configure --prefix=/usr/local/zookeeper

8.安装

make && make install

四、安装PHP zookeeper扩展

wget http://pecl.php.net/get/zookeeper-0.6.4.tgz
tar zxvf zookeeper-0.6.4.tgz
cd zookeeper-0.6.4
phpize
./configure -with-libzookeeper-dir=/usr/local/zookeeper
make && make install

五、开启扩展配置
最后往php.ini里面添加

extension=zookeeper.so

猜你喜欢

转载自blog.csdn.net/wuxing26jiayou/article/details/106214111