💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
pecl官方地址:http://pecl.php.net/package/rdkafka 客户端:https://github.com/arnaud-lb/php-rdkafka librdkafka:https://github.com/edenhill/librdkafka/releases?after=v0.9.0 启动Zookeeper server: sh bin/zookeeper-server-start.sh config/zookeeper.properties & 启动Kafka server: sh bin/kafka-server-start.sh config/server.properties & #######################安装过程start############################## 1、安装librdkafka cd /usr/local/src #进入安装包存放目录 wget https://github.com/edenhill/librdkafka/archive/master.zip #下载 mv master.zip librdkafka-master.zip #修改包名 unzip librdkafka-master.zip #解压 cd librdkafka-master #进入安装文件夹 ./configure #配置 make #编译 make install #安装 2、安装phpkafka cd /usr/local/src #进入安装包存放目录 wget https://github.com/EVODelavega/phpkafka/archive/master.zip #下载 mv master.zip phpkafka-master.zip #修改包名 unzip phpkafka-master.zip #解压 cd phpkafka-master #进入安装文件夹 /usr/local/php/bin/phpize #加载php扩展模块 ./configure --enable-kafka --with-php-config=/usr/local/php/bin/php-config #配置 make #编译 make install #安装 3、修改php配置文件 vi /usr/local/php/etc/php.ini #打开php配置文件,在最后一行添加下面的代码 extension="kafka.so" :wq! #保存退出 #######################安装过程end############################## 安装配置中遇到的坑: WARNING:pykafka.rdkafka._rd_kafka:pykafka.rdkafka#producer-1 [PROTOERR] **.**.**.**:9092/1: Protocol parse failure at rd_kafka_produce_reply_handle:1779 WARNING:pykafka.rdkafka._rd_kafka:pykafka.rdkafka#producer-1 [PROTOERR] **.**.**.**:9092/1: expected 4 bytes > 0 remaining bytes 直接安装低版本的(我的从0.9.5降低到0.8.6)可以解决问题;