下面是 PHP 生产、消费 Kafka 消息的例子(假设已经配置好 Kafka):1.从 zookeeper 源码 src/c/src 安装 zookeeper c clientcd zookeeper-3.4.10/src/c./configuremake && make install或者 编译 php libzookper 扩展git clone https://github.com/Timandes/libzookeeper.gitcd libzookeeperphpize./configure --with-libzookeeper=/usr/local/bin/cli_mtmake && make install编译 php zookeeper 扩展git clone https://github.com/php-zookeeper/php-zookeeper.gitcd php-zookeeperphpize./configuremake && make install4.修改 php.ini 配置,添加 libzookeeper 和 php-zookeeper 扩展vim /etc/php/7.0/cli/php.iniextension=libzookeeper.soextension=zookeeper.soroot@alex-virtual-machine:/usr/src/libzookeeper# /etc/init.d/php7.0-fpm restartroot@alex-virtual-machine:/usr/src/libzookeeper# service nginx restart
安装
/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
./configure
make
sudo make install
更多内容关注我的订阅号
个人博客 www.zxb8.cc 自学吧