PHP安装Kafka扩展 rdkafka记录

Publish: May 27, 2022 Category: 运维 No Comments

lnmp下最简单的方式

/usr/local/php/bin/pecl install rdkafka

如果是其他方式务必以php绝对路径执行该安装过程。

如果报错可尝试安装:librdkafka

#报错信息
checking for librdkafka/rdkafka.h" in default path... not found
configure: error: Please reinstall the rdkafka distribution

源码安装librdkafka

$ git clone https://github.com/edenhill/librdkafka.git
$ cd librdkafka
$ ./configure
$ make && make install

重新执行rdkafa安装命令如果没有提示错误
看看是否安装成功:

php -m | grep rdk

Tags: kafka, rdkafka, librdkafka

Related Posts:

Leave a Comment