Hello,
Since compiling ZMQ for PHP 8 NTS in Windows Server(IIS) were never fully documented I’d like to share how I managed to do this.
-
Download and install Visual Studio Build Tools 2019
Create a network-based installation - Visual Studio (Windows) | Microsoft Learn
https://aka.ms/vs/16/release/vs_buildtools.exe
-
Download and extract Tool kit for building PHP under Windows
GitHub - microsoft/php-sdk-binary-tools: Tool kit for building PHP under Windows
https://github.com/microsoft/php-sdk-binary-tools/archive/refs/heads/master.zip -
Download and extract source code of PHP 8
PHP For Windows: Binaries and sources Releases
-
Download and extract Source code (zip) of php-zmq
Release zmq 4.3.4 - prebuilt Windows php extension binaries · stijnvdb88/php-zmq · GitHub -
Download and extract lib-zmq 4.3.4
libzmq-v142-x64-4_3_4.zip
Releases · zeromq/libzmq · GitHub -
Run Developer Command Prompt for VS 2019
-
Change directory to
\php-sdk-binary-tools-master\
-
Run
phpsdk-vs16-x64
-
Execute
phpsdk_buildtree phpdev
-
Copy PHP source code directory to
\php-sdk-binary-tools-master\phpdev\vs16\x64\
-
Copy php-zmq-4.3.4 (step 4.) to
\php-sdk-binary-tools-master\phpdev\vs16\x64\php-8.2.21-src\ext\
and rename to zmq -
Edit
\php-sdk-binary-tools-master\phpdev\vs16\x64\php-8.2.21-src\ext\zmq\config.w32
file by addingtrue
as third parameter inEXTENSION
function
-
Copy zmq.h from lib-zmq 4.3.4 (step 5.) to
\php-sdk-binary-tools-master\phpdev\vs16\x64\deps\include\
-
Copy libzmq-v142-mt-4_3_4.lib from lib-zmq 4.3.4 (step 5.) to
\php-sdk-binary-tools-master\phpdev\vs16\x64\deps\lib\
and rename to libzmq.lib -
Go back to Developer Command Prompt for VS 2019 console and change directory to
\php-sdk-binary-tools-master\phpdev\vs16\x64\php-8.2.21-src\
-
Execute
buildconf --force
-
Execute
configure --disable-all --disable-zts --enable-cli --with-zmq
Verify if zmq.h and libzmq.lib were loaded and if zmq is visible in Enabled extensions. -
Execute
nmake
-
Go to
\php-sdk-binary-tools-master\phpdev\vs16\x64\php-8.2.21-src\x64\Release\
and there you have php.zmq.dll -
Copy libzmq-v142-mt-4_3_4.dll from lib-zmq 4.3.4 (step 5.) to
<your PHP directory>\
and php.zmq.dll to<your PHP directory>\ext\