简单记录下安装过程。
php8以上版本就注意:
1.建议用最新的源码 https://github.com/php-zookeeper/php-zookeeper/tree/0.8.x
2.如果报找不到什么文件 zookeeper.jute.c zookeeper.jute.h ,可以拷贝过去,这里指的是zookeeper-client-c /apache-zookeeper-3.5.9/zookeeper-client/zookeeper-client-c/generated# cp ./* ../include/
3.更多详情见:https://github.com/php-zookeeper/php-zookeeper/tree/0.8.x
4.zookeeper ui https://github.com/DeemOpen/zkui
一、安装libzookeeper
cd /usr/local/src/
wget http://mirror.bit.edu.cn/apache//zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz
tar -xf zookeeper-3.4.5.tar.gz
cd zookeeper-3.4.5/src/c
./configure –prefix=/usr/local/zookeeper/zookeeper-3.4.5/
make && make install
libzookeeper编译神奇的地方在于解压完需要进入到src/c目录,而不是常见软件的解压后第一级目录。
二、安装php zookeeper扩展
cd /usr/local/src/
wget ‘http://pecl.php.net/get/zookeeper-0.2.2.tgz’
tar zxvf zookeeper-0.2.2.tgz
cd zookeeper-0.2.2
phpize
./configure –with-php-config=/usr/local/php/bin/php-config –with-libzookeeper-dir=/usr/local/zookeeper/zookeeper-3.4.5/
make && make install
执行phpize有个问题,发现没有configure文件,基于经验。应该是没有安装automake
yum install automake
然后在执行phpize即可。
三、修改php.ini配置,启用zk扩展
vim /usr/local/php/etc/php.ini
添加:extension=zookeeper.so
注意:先查找 extension_dir 是否已经配置过。php-config libzookeeper-dir路径一定要正确