php 安装 zookeeper 扩展

原创
2018/08/17 12:03
阅读数 416

php 安装 zookeeper 扩展

 


下面是 PHP 生产、消费 Kafka 消息的例子(假设已经配置好 Kafka):

1.从 zookeeper 源码 src/c/src 安装 zookeeper c client

cd zookeeper-3.4.10/src/c
./configure
make && make install


或者 编译 php libzookper 扩展


git clone https://github.com/Timandes/libzookeeper.git
cd libzookeeper
phpize
./configure --with-libzookeeper=/usr/local/bin/cli_mt
make && make install



编译 php zookeeper 扩展

git clone https://github.com/php-zookeeper/php-zookeeper.git
cd php-zookeeper
phpize
./configure
make && make install



4.修改 php.ini 配置,添加 libzookeeper 和 php-zookeeper 扩展


vim /etc/php/7.0/cli/php.ini

extension=libzookeeper.so
extension=zookeeper.so



root@alex-virtual-machine:/usr/src/libzookeeper# /etc/init.d/php7.0-fpm restart

root@alex-virtual-machine:/usr/src/libzookeeper# service nginx restart

 

安装

http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.8/zookeeper-3.4.8.tar.gz
/root/zookeeper-3.4.8/src/c
./configure -prefix=/usr/local/zookeeper/zookeeper-3.4.8/
php 扩展
./configure –with-php-config=/usr/bin/php-config -with-libzookeeper-dir=/usr/local/zookeeper/zookeeper-3.4.8/

 

 

安装 librdkafka

https://github.com/edenhill/librdkafka

 

 
  1. ./configure
  2. make
  3. sudo make install

 

更多内容关注我的订阅号

 

个人博客 www.zxb8.cc 自学吧

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部