Read this article first: How to build PHP 8 on Windows
Example, we need to build extension phpredis:
https://github.com/phpredis/phpredis
We follow 8 first steps in this article
Step 9: download extension source code https://github.com/phpredis/phpredis/archive/refs/heads/release/6.0.2.zip
then unzip to folder F:\php-sdk\php-dev\vs16\x64\php-8.2.16-src\ext\redis
Step 10: compile PHP
cd F:\php-sdk\php-dev\vs16\x64\php-8.2.16-src nmake clean F:\php-sdk\phpsdk-vs16-x64.bat buildconf configure --disable-all --enable-cli --enable-redis=shared nmake
result:
... $ buildconf Rebuilding configure.js Now run 'configure --help' F:\php-sdk\php-dev\vs16\x64\php-8.2.16-src $ configure --disable-all --enable-cli --enable-redis=shared PHP Version: 8.2.16 Saving configure options to config.nice.bat Checking for cl.exe ... <in default path> Detected compiler Visual C++ 2019 Detected x64 compiler Checking for link.exe ... <in default path> Checking for nmake.exe ... <in default path> Checking for lib.exe ... <in default path> Checking for bison.exe ... <in default path> Detected bison version 3.3.2 Checking for sed.exe ... <in default path> Checking for re2c.exe ... <in default path> Detected re2c version 1.1.1 Checking for zip.exe ... <in default path> Checking for lemon.exe ... <in default path> Checking for 7za.exe ... <in default path> Checking for mc.exe ... C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64 Checking for mt.exe ... C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64 Enabling multi process build Build dir: F:\php-sdk\php-dev\vs16\x64\php-8.2.16-src\x64\Release_TS PHP Core: php8ts.dll and php8ts.lib Checking for ML64.exe ... <in default path> Checking for wspiapi.h ... <in default path> Enabling IPv6 support Enabling SAPI sapi\cli Checking for library edit_a.lib;edit.lib ... <not found> Enabling extension ext\date Enabling extension ext\hash Checking for KeccakHash.h ... ext/hash/sha3/generic64lc Checking for PMurHash.h ... ext/hash/murmur Checking for xxhash.h ... ext/hash/xxhash Enabling extension ext\json Enabling extension ext\pcre Enabling extension ext\random Enabling extension ext\reflection Enabling extension ext\spl Checking for timelib_config.h ... ext/date/lib Enabling extension ext\standard Enabling extension ext\redis [shared] Creating build dirs... Generating files... Generating Makefile Generating main/internal_functions.c [content unchanged; skipping] Generating main/config.w32.h Generating phpize Done. Enabled extensions: ----------------------- | Extension | Mode | ----------------------- | date | static | | hash | static | | json | static | | pcre | static | | random | static | | redis | shared | | reflection | static | | spl | static | | standard | static | ----------------------- Enabled SAPI: ------------- | Sapi Name | ------------- | cli | ------------- ----------------------------------------- | | | ----------------------------------------- | Build type | Release | | Thread Safety | Yes | | Compiler | Visual C++ 2019 | | Target Architecture | x64 | | Host Architecture | x64 | | Optimization | PGO disabled | | Native intrinsics | SSE2 | | Static analyzer | disabled | ----------------------------------------- Type 'nmake' to build PHP F:\php-sdk\php-dev\vs16\x64\php-8.2.16-src $ nmake Microsoft (R) Program Maintenance Utility Version 14.29.30154.0 Copyright (C) Microsoft Corporation. All rights reserved. Recreating build dirs backoff.c cluster_library.c library.c redis.c redis_array.c redis_array_impl.c redis_cluster.c redis_commands.c redis_sentinel.c redis_session.c sentinel_library.c ext\redis\library.c(466): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(812): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\cluster_library.c(1755): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(468): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\cluster_library.c(1757): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\cluster_library.c(1758): warning C4098: 'cluster_hrandfield_resp': 'void' function returning a value ext\redis\redis_commands.c(968): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\cluster_library.c(1769): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(991): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(1246): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(999): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\cluster_library.c(1815): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(1258): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(1011): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\cluster_library.c(1824): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\cluster_library.c(1838): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(1441): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\cluster_library.c(1840): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(1107): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(1453): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\cluster_library.c(1851): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(1112): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(1455): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\cluster_library.c(1860): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(1162): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(1468): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\cluster_library.c(1862): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(1481): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(1353): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\cluster_library.c(2218): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(1494): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(1496): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(1509): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(1503): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\cluster_library.c(2441): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(1519): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(1514): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\cluster_library.c(2443): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(1521): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(1545): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(2092): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(1827): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(2147): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(1852): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(2179): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(2183): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(2189): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(2018): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(2195): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(2020): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(2201): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(2022): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(2207): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(2024): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(2210): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(2026): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(2212): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(2068): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(2070): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(2363): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(2109): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(2111): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(2369): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(2374): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(2490): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(2492): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(3367): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(2494): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(2496): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\library.c(2498): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(3543): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(3548): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(3597): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(3709): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(3959): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(3979): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(3981): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(4479): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(4985): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(5002): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(5006): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(5010): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(5015): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(5032): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(5050): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(5066): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(5074): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(5079): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(5083): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(5101): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(5105): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(5136): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(5145): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(5147): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size ext\redis\redis_commands.c(5764): warning C4312: 'type cast': conversion from 'unsigned int' to 'char *' of greater size Creating library F:\php-sdk\php-dev\vs16\x64\php-8.2.16-src\x64\Release_TS\php8ts.lib and object F:\php-sdk\php-dev\vs16\x64\php-8.2.16-src\x64\Release_TS\php8ts.exp Creating library F:\php-sdk\php-dev\vs16\x64\php-8.2.16-src\x64\Release_TS\php_redis.lib and object F:\php-sdk\php-dev\vs16\x64\php-8.2.16-src\x64\Release_TS\php_redis.exp EXT redis build complete Creating library F:\php-sdk\php-dev\vs16\x64\php-8.2.16-src\x64\Release_TS\php.lib and object F:\php-sdk\php-dev\vs16\x64\php-8.2.16-src\x64\Release_TS\php.exp mt.exe : general error c101008d: Failed to write the updated manifest to the resource of file "F:\php-sdk\php-dev\vs16\x64\php-8.2.16-src\x64\Release_TS\php.exe". The process cannot access the file because it is being used by another process. SAPI sapi\cli build complete
Done! output: F:\php-sdk\php-dev\vs16\x64\php-8.2.16-src\x64\Release_TS\php_redis.dll
Download:
phpredis windows extension for PHP 8.2 vs16 x64 TS