php 安装 zookeeper 扩展

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

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 自学吧

转载于:https://my.oschina.net/yonghan/blog/1929511

你可能感兴趣的:(php 安装 zookeeper 扩展)