phpapache-kafkalibrdkafka

Why can't find RdKafka?


I have a dockerfile:

FROM php:7.4.9-fpm
...............................
RUN apt-get install librdkafka-dev -y
RUN pecl install rdkafka \
    && docker-php-ext-enable rdkafka

After docker-compose build and up -d, exec container php, make php -m and I saw rdkafka in module list.

Similary in composer.json added and installed:

"require": {
        "php": "^7.2.5",
        "ext-rdkafka": "*",

In this project I used php framework Lumen.
The question: when I'm trying in any class to put $conf = new RdKafka\Conf(); - every time I got an error: Undefined class 'Conf'

Why?


Solution

  • You need to install ext-rdkafka.