在工作中我们经常遇到需要给php安装插件,今天把php安装kafka的插件的步骤整理下,仅供大家参考
1:需要先安装librdkafka
git clone https://github.com/edenhill/librdkafka.git
./configure --prefix=/usr/local/product/librdkafka
make
make install
ln -s /usr/local/product/librdkafka/lib/lib* /usr/local/lib
ln -s /usr/local/product/librdkafka/include/librdkafka /usr/local/include
2:安装rdkafka插件
git clone https://github.com/arnaud-lb/php-rdkafka.git
cd php-rdkafka
phpize
./configure --help | grep rdkafka
./configure --with-rdkafka --with-php-config=/usr/local/php/bin/php-config
make
make install
3:在php.ini配置中添加你新增的插件
4:php -m就可以看到你安装的插件了