Php-rdkafka: PHP-RDKAFKA not working in Windows

Created on 16 Mar 2018  Â·  14Comments  Â·  Source: arnaud-lb/php-rdkafka

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. 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

Please help me.

Most helpful comment

Just to be a little more clear. I had the same problem and you should really update the docs to state that php_rdkafka.dll must be placed in ..\PHPext\ AND librdkafka.dll must be placed in ..\PHP. Otherwise you will receive the error mentioned above.

All 14 comments

Try putting the included rdkafka.dll file in your php directory, just above ext. I had a similar issue and that seemed to clear it up.

Just to be a little more clear. I had the same problem and you should really update the docs to state that php_rdkafka.dll must be placed in ..\PHPext\ AND librdkafka.dll must be placed in ..\PHP. Otherwise you will receive the error mentioned above.

@Eggybread610 thanks a lot my problem solved after 2 hours searching

Been trying to get this working all day.
Did as you said. Previously I was getting the error above, now I am getting a different error.

The procedure entry point spprintf could not be located in the dynamic link library C:xamppphpextphp_rdkafka.dll.

error

It seems you're missing core PHP source files (https://github.com/php/php-src/blob/master/main/spprintf.c). Did you build phprdkafka against the same PHP version that you're using?

@Steveb-p I did not build the php-rdkafka myself, I downloaded it from PECL just like OP.

I am using XAMPP running php v. 7.3.7.
Compiler: MSVC15 (Visual C++ 2017)
Architecture: x64
Thread Safety: enabled

i checked and it seems spprintf has been around since pretty much forver (and i see you are using 7.3.7 anyway). I am not too familiar with XAMPP but maybe some of the links are not being properly resolved or it lies in a very specific place and it has been configured differently...
a quick google search with windows php entry point not found leads me to believe, that maybe something not loaded or paths are misconfigured...
@Wiggyboy let us know if you have any more input that helps us narrow it down

@nick-zh I downgraded to php to v. 7.1.30 and the pesty error message disappeared. I have not had time to try if it's working properly because I don't have my kafka cluster setup on this environment. But loading the php examples, I recieved no issues of missing classes etc so seems very promising.

I did try thereafter upgrading php to v. 7.2.20. But the error message returned. I'll stick with whatever php version is working with this now but looking forward to know if you guys can find a fix for versions higher than 7.1.30.

Final note, the only thing I noticed different from the versions is how the extensions are mentioned inside of the _php.ini_. Versions 7.1.30 and prior they want you to format like the filename itself, (extension=php_<modulename>.<extension> where <extension> will be .dll for windows and .so for UNIX) whilst versions later they want you to format like extension=<modulename>.
I don't know why this would make any difference and I don't think it is the cause of the problem, but... ¯\_(ツ)_/¯

There is a high chance - nearing certainty - that DLLs created for version 7.1 of PHP will link to different locations in memory than 7.2, making build targeting PHP 7.1 unusable to any other version. That's how almost every extension behaves.

The same goes with using ZTS and non-ZTS versions.

Apparently you've downloaded a DLL for PHP 7.1, so it didn't work in PHP 7.2.

@Steveb-p Oh, perhaps it was my mistake to begin with then. I knew the .dll was for v. 7.1, but since it was the only downloadable version and it says,

PHP Version: PHP version 7.99.99 or older
PHP Version: PHP 5.6.0 or newer

I thought it would not matter. My apologies >.<'
I would be good if the installation guide were more thorough. Thanks anyways!

Yeah @Wiggyboy, well, it's not like there is a high level of support for windows extensions anyways :)

There is often a request for a particular version of phprdkafka to be pushed to PECL, but compiling it under windows seems to be rather troublesome :) Oftentimes a .dll is simply missing, not added to PECL after release :cry:

good catch, i added a small hint to the windows installation section and made a PR

@arnaud-lb i think we can close this

For PHP 7.2 binaries can be found here http://windows.php.net/downloads/pecl/snaps/rdkafka/
Also, do not forget to add librdkafka.dll (C:xamppphplibrdkafka.dll), because may have an issue described here https://github.com/arnaud-lb/php-rdkafka/issues/152

Was this page helpful?
0 / 5 - 0 ratings