Ligo George
Ligo George

Reputation: 889

Installing librdkafka on Windows for PHP XAMPP

Please help me to install librdkafka on windows xampp for php development.

PHP : 7.1.12, x86, Thread Safe, MSVC14

I downloaded compatible package from https://pecl.php.net/package/rdkafka/3.0.5/windows

Copied php_rdkafka.dll to ext folder of my php xampp and librdkafka.dll to System32 folder (also to ext folder).

But the extension is not working. I am getting following error:

PHP Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_rdkafka.dll' - The specified module could not be found. in Unknown on line 0

I suspect that librdkafka is not properly installed.

Upvotes: 4

Views: 6950

Answers (2)

Dan
Dan

Reputation: 3584

The accepted answer did not work for me, instead I installed the dependency as following:

  • Download the library from https://pecl.php.net/package/rdkafka
  • Extract the file librdkafka.dll to the the root PHP directory (same level as php.exe for example C:\xampp\php).
  • Extract the file php_rdkfaka.dll to the ext folder: C:\xampp\php\ext
  • Add the line extension=php_rdkafka.dll to the php.ini.
  • Restart the server.

Note: within the library you will download, you will find a README.md with a link to the official documentation.

Upvotes: 4

Ligo George
Ligo George

Reputation: 889

I managed to make it work by doing below steps.

  1. Copy librdkafka.dll to C:\Windows\SysWOW64 if x86 otherwise copy to C:\Windows\System32. Don't copy to both folders.
  2. Then run regsvr32 librdkafka.dll in command prompt.
  3. Then copy php_rdkafka.dll to ext folder of your php.
  4. Then add extension=php_rdkafka.dll to your php.ini file
  5. Restart PHP, DONE!!!

Upvotes: 3

Related Questions