Home  >  Article  >  Backend Development  >  How to install kafka extension in php7

How to install kafka extension in php7

醉折花枝作酒筹
醉折花枝作酒筹forward
2021-05-14 09:18:261554browse

This article will introduce to you how to install kafka extension in php7. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

How to install kafka extension in php7

1. Install librdkafka

# cd /usr/local/src/
# git clone https://github.com/edenhill/librdkafka.git
 # cd librdkafka
 # ./configure
 # make
 # make install
 # ln -s /usr/local/lib/librdkafka.so.1 /usr/lib/

2. Install php-rdkafka

# cd /usr/local/src/
 # git clone https://github.com/arnaud-lb/php-rdkafka.git
 # cd php-rdkafka
 # /usr/local/php/bin/phpize
 # ./configure --with-php-config=/usr/local/php/bin/php-config
 # make all -j 5
 # make install

3. Modify php.ini

# vi /etc/php.ini

##Add the following code:

##
extension=rdkafka.so

## Check whether the installation is successful:

##
# /usr/local/php/bin/php  -m

4. Restart php-fpm

# service php-fpm restart

Recommended learning: php video tutorial

The above is the detailed content of How to install kafka extension in php7. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete