Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding the ZeroMQ PHP extension to XAMPP on Windows 10 and PHP7

I am having issues adding the ZeroMQ PHP extension to XAMPP.

Setup: Windows 10, PHP7, XAMPP (7.0.9)

Steps I already took:

  1. Added PHP (D:\xampp7\php) and PHP extensions (D:\xampp7\php\ext) directories to system variable (PATH)

  2. Followed the instructions on zeromq.org. I downloaded x86ts version from the pecl repository as the listed snapshot link (http://snapshot.zero.mq/) was down.

  3. Copied libzmq.dll into PHP directory and php_zmq.dll into the PHP extension directory

  4. Updated php.ini (D:\xampp7\php\php.ini) by adding extension=php_zmq.dll and checked the extensions directory which is extension_dir="D:\xampp7\php\ext"

  5. Restarted XAMPP via the control panel.

The Apache error log shows the following:

[Sat Nov 26 18:30:27.461679 2016] [ssl:warn] [pid 15280:tid 588] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sat Nov 26 18:30:27.546320 2016] [core:warn] [pid 15280:tid 588] AH00098: pid file D:/xampp7/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Sat Nov 26 18:30:27.630955 2016] [ssl:warn] [pid 15280:tid 588] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
PHP Warning:  PHP Startup: Unable to load dynamic library 'D:\\xampp7\\php\\ext\\php_zmq.dll' - Das angegebene Modul wurde nicht gefunden.\r\n in Unknown on line 0
[Sat Nov 26 18:30:27.662208 2016] [mpm_winnt:notice] [pid 15280:tid 588] AH00455: Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/7.0.9 configured -- resuming normal operations
[Sat Nov 26 18:30:27.662208 2016] [mpm_winnt:notice] [pid 15280:tid 588] AH00456: Apache Lounge VC14 Server built: Jul  1 2016 11:09:37
[Sat Nov 26 18:30:27.662208 2016] [core:notice] [pid 15280:tid 588] AH00094: Command line: 'd:\\xampp7\\apache\\bin\\httpd.exe -d D:/xampp7/apache'
[Sat Nov 26 18:30:27.662208 2016] [mpm_winnt:notice] [pid 15280:tid 588] AH00418: Parent: Created child process 964
[Sat Nov 26 18:30:28.363210 2016] [ssl:warn] [pid 964:tid 616] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name

Update:

It looks like the module cannot be found, but if I add the x64 Version the Apache error log indicates that the module is not a not a valid Win32 application.

PHP Warning:  PHP Startup: Unable to load dynamic library 'D:\\xampp7\\php\\ext\\php_zmq.dll' - %1 ist keine zul\xef\xbf\xbdssige Win32-Anwendung.\r\n in Unknown on line 0

Solution:

Adding LoadFile "D:/xampp7/php/libzmq.dll"to httpd.conf fixed my issue.

like image 380
ju_ Avatar asked Nov 26 '16 17:11

ju_


People also ask

Where is the PHP extension directory windows?

PHP extensions are usually called "php_*. dll" (where the star represents the name of the extension) and they are located under the "PHP\ext" folder. PHP ships with the extensions most useful to the majority of developers. They are called "core" extensions.

What is PHP extension directory?

So after installation of PHP the best way to identify the extension directory is to open php info file and check for all the settings. In the php info display it will be written where the extension file of the system is stored. It is also known as extension_dir .


2 Answers

I know this is an old question although I just spent 2 days trying to get ZeroMQ to load properly. If anyone still cant get it to work after following all the basic instructions, I have 2 more steps you can look into.

Got it working with php 7.3.12, Win10 x64

1st. Make sure you edit all php.ini files.

If you use wamp server, Apache will have it's own php.ini that is opened up when you click on the wamp icon in the bottom right of windows and go to php->php.ini. Then manually add the same extension=php_zmq.dll there as well as your php.ini under D:\xampp7\php\php.ini. To be honest, I'm not 100% sure that this is necessary but including it on both cant hurt.

2nd. Run deplister.exe on libzmq.dll

This is what got it working for me. Any php download from windows.php.net should have deplister.exe (it is included in wamp php versions too). Go to your php version library on your wamp server where libzmq.dll and deplister.exe are located. Then open up cmd and run the line: deplister php_zmq.dll This will show you a list of the dependencies that php_zmq.dll requires to run. You may notice that it requires a VERY specific version of libzmq.dll so go and rename your dll file to the requested file name. Then run php -m to see if zmq is displayed on the list of modules. If so, you should be able to run commands like composer update to get the required library versions imported into your project without error!

like image 149
Ian McCleary Avatar answered Oct 12 '22 21:10

Ian McCleary


these steps worked for me (php 7.1.7 - xampp - window 10 x64)

Step 1

download x86 dll files from this site

Step 2

copy php_zmq.dll to C:\xampp\php\ext

Step 3

copy libsodium.dll and libzmq.dll to C:\xampp\php

Step 4

add extension=php_zmq.dll to php.ini file

Step 5

restart apache

like image 39
mostafaznv Avatar answered Oct 12 '22 20:10

mostafaznv