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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章