10

I am looking for installing zeromq on my Windows 7 machine for using zeromq with PHP (I am using WAMP server (5.3.4), Apache Server 2.2.17).

I followed the documentation on their site, but I don't know what to do. I installed the zeromq from the following site, then I tried to copy the dll from this site but it's down.

Where can I get the DLL? Am I want to install only the Windows installer from from this link, or is there anything else needed?

I have downloaded the dll from this site http://178.79.157.189/~mikko/win32/php-zmq-win32.zip


I'm using PHP 5.3.4 x64 version and Windows 7 x64. I tried the following steps:

  1. I have installed ZeroMQ-3.2.2rc2~miru1.5-x64

  2. copied libzmq.dll to c:\wamp\bin\php\php5.3.4

  3. copied php-zmq\php53\php53-ts_zeromq-3.2.2 to c:\wamp\bin\php\php5.3.4\ext

  4. enabled the php_zmq extension in php.ini

  5. I restarted the WAMP. It shows

    'c:/wamp/bin/php/php5.3.4/ext/php_zmq.dll' - %1 is not a valid win32 application

What could be the problem?

Again I tried with the Wamp x86(php 5.4.3) version and windows 7 x64

  1. I have installed ZeroMQ-3.2.2rc2~miru1.5-x86.exe

  2. copied libzmq.dll to c:\wamp\bin\php\php5.4.3

  3. copied php-zmq\php54\php54-ts_zeromq-3.2.2 to c:\wamp\bin\php\php5.4.3\ext

  4. enabled the php_zmq extension in php.ini

  5. I restarted the WAMP. It shows

    PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.4.3/ext/php_zmq.dll' - The specified module could not be found.\r\n in Unknown on line 0

0

7 Answers 7

10

Given that this is the top search result on Google for zeromq dll problems with PHP on windows, i'm adding my two cents to it.

Proper Steps to setting up zeroMQ with PHP:

1) Download the correct DLL package for PHP

DLL Download Page for PHP ZeroMQ is now found at http://pecl.php.net/package/zmq (http://snapshot.zeromq.com is dead) A tiny 'DLL' link will be present beside each 'available release'. That's your link. Click on it, and select your dll based on your PHP version and whether it's thread Safe (TS) or Non-thread Safe (NTS).

If you are coming from the XAMPP Package, your DLL should be TS & x86 version.

2) Make sure you have the correct Microsoft Visual C++ Redistributable Package installed.

As of this writing, the correct version is the 2012 one. Link to download Package: http://www.microsoft.com/en-us/download/details.aspx?id=30679

3) Copy the phpzmq.dll & libzmq.dll (from the dll package in step 1) to your PHP\Extensions Directory (Default XAMPP php ext path is: C:\xampp\php\ext)

4) Add the phpzmq.dll to your PHP.ini

5) Add the PHP\extensions directory to your PATH system environment variables (very important) & restart your machine

Upon restart, start your apache & pray to the PHP gods.

FAQ for common errors:

1) I have a popup saying "'libzmq.dll' is missing from my computer" when starting apache.

Well darn, make sure you followed step 5 to the letter and verify that the directory path is correct and the dll is present in that directory.

2) Another popup saying "'php5.dll' is missing from my computer" when starting apache.

Looks like you got the wrong dll for your php version. Download the correct one from step 1.

3) A random popup appeared saying "'phpzmq.dll' is not a valid win 32 application."

That DLL is still not correct. Make sure you got the right one (x86 or x64) and that it is either thread safe or non-thread safe. How would you know? Time to play DLL roulette.

Hoping this post actually helps the users who land here :)

1
  • Great answer thanks. I have been looking for a link to the correct dll's for ages.
    – ibanore
    Sep 6, 2014 at 10:06
3

@Mysteryos's answer is quite informative but it is inaccurate. There are few mistakes in step 3 & 4 worth to mention.

Correct procedure in WAMP server
Step 3)

  • i) Copy libzmq.dll to php bin root directory (eg. C:\wamp\bin\php\php5.5.12)
  • ii) Copy php_zmq.dll to php extensions directory (eg. C:\wamp\bin\php\php5.5.12\ext)
  • I am using the php_zmq-1.1.2-5.5-ts-vc11-x64.zip (php 5.5, thread safe) which can obtain from this link http://pecl.php.net/package/zmq.
  • Make sure you download the one which match your php version (5.x), else you will get "Another popup saying "'php5.dll' is missing from my computer" when starting apache" error


Step 4)
Add the phpzmq.dll declaration to your PHP.ini

It is important to notice that there are few php.ini in WAMP server directory.
The correct php is in C:\wamp\bin\apache\apache2.4.9\php.ini
Append the following declaration into the php.ini mentioned above.

[ZMQ]
extension=php_zmq.dll
2
  • 1
    Yeah! Nice catch copying libzmq.dll and libsodium.dll to php root dir
    – manix
    May 14, 2017 at 3:12
  • "Copy libzmq.dll to php bin root directory" did the job..ty
    – Sid
    Jun 26, 2017 at 19:47
2

I had the same problem. Using dll from php-zmq_zeromq-{version}-zts folder fixed the problem for me.

1
  • from where we can get that dll can you share me? Jun 6, 2013 at 4:38
0

I followed the instructions by @Mysteryos and @Zcythe, but I was still receiving a Unable to load module error, so after reviewing the WAMP forums in french I got it to work following the next changes after step 4:

Edit the file config.inc.php located in C:\wamp\scripts

Look for:

$phpDllToCopy = array_merge(
    $php_icu_dll,
    array (
    'libmysql.dll',
    'libeay32.dll',
    'libsasl.dll',
    'libpq.dll',
    'libssh2.dll', //For php 5.5.17
    'php5isapi.dll',
    'php5nsapi.dll',
    'ssleay32.dll',
    'php5ts.dll',
    'php7ts.dll', //For PHP 7
    )
);

And then add the 2 ZeroMQ libraries so it looks like:

$phpDllToCopy = array_merge(
    $php_icu_dll,
    array (
    'libmysql.dll',
    'libeay32.dll',
    'libsasl.dll',
    'libpq.dll',
    'libssh2.dll', //For php 5.5.17
    'php5isapi.dll',
    'php5nsapi.dll',
    'ssleay32.dll',
    'php5ts.dll',
    'php7ts.dll', //For PHP 7
    'Libsodium.dll', //The ZMQ Libraries
    'Libzmq.dll'
    )
);

Restart WAMP and it has to work properly.

I tested this with the following ZMQ library:

https://pecl.php.net/package/zmq/1.1.3/windows

  • (7.0 Thread Safe (TS) x64, PHP 7.0.10)

Greetings!

0

Steps to install zeroMQ in PHP 5.3, PHP 7.1, and 7.2 on Windows

Most likely you want your PHP version, x64, and Thread Safe
but you may have a x32 version of PHP

$ php -i | grep Architecture  
Architecture => x64
  • for PHP 5.3

download 5.3 Thread Safe (TS) x86
extract and copy the dlls

copy libzmq.dll into
C:\wamp\bin\php\php5.3.4
there is no libsodium.dll in PHP 5.3

copy php_zmq.dll into
C:\wamp\bin\php\php5.3.4\ext

add the extension to your php.ini,
usually with the other Dynamic Extensions

extension=php_zmq.dll

  • for PHP 7.1

download 7.1 Thread Safe (TS) x64
extract and copy the dlls

copy libzmq.dll and libsodium.dll into
C:\laragon\bin\php\php-7.1.20-Win32-VC14-x64
there is an extra dll libsodium.dll for PHP 7.1

copy php_zmq.dll into
C:\laragon\bin\php\php-7.1.20-Win32-VC14-x64\ext

add the extension to your php.ini, usually with the other Dynamic Extensions

extension=php_zmq.dll

  • for PHP 7.2

download 7.2 Thread Safe (TS) x64
extract and copy the dlls

copy libzmq.dll into
C:\laragon\bin\php\php-7.2.11-Win32-VC15-x64
there is no libsodium.dll after PHP 7.1

copy php_zmq.dll into
C:\laragon\bin\php\php-7.2.11-Win32-VC15-x64\ext

add the extension to your php.ini, usually with the other Dynamic Extensions

extension=zmq

  • verify by viewing php info
$ php -i | grep zmq  
zmq  
libzmq version => 4.1.3
0

I've lost many times in resolution of that.. I've tested many zmq versions and many configuration..

The final solution:

libzmq.dll need to be in xampp/apache/bin/ folder for it to be load the extension.

(solution from: https://stackoverflow.com/questions/54012625/windows-zmq-dll-issue-for-php-7-2)

1
  • 1
    Please quote and cite the relevant information from the Stack Overflow question.
    – Ramhound
    Sep 12, 2020 at 2:20
-1

The only right answer is @catanella https://superuser.com/a/1584707/1272360

libzmq.dll MUST be in apache/bin/ and not in php/bin/

I do confirm - that helped. Win10, WAMP, PHP 7.4.9. CGI or Apache Module mode - no matter, works both. Libs used from next link (files in archive should not be renamed) https://github.com/zeromq/php-zmq/issues/193#issuecomment-605456811

2
  • Please add further details to expand on your answer, such as working code or documentation citations.
    – Community Bot
    Aug 30, 2021 at 0:40
  • @Community read the subject - all is clear enough when you are not the robot Aug 30, 2021 at 12:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .