I tried to compile the php_redis.dll for PHP 7.0, but after testing and debugging for a whole day, I finally got some errors. I hope my compiling log will be helpful to you.
我尝试了一天在 php 7.0 下去编译 php_redis.dll,虽然没有成功,但是感觉已经离得很近了,因此写下一天的记录,也许能够帮助到你。
References
Environment
Visual Studio 2015: We need the “Developer Command Prompt for VS2015” which is "VS2015 开发人员命令提示" in Chinese.
WAMP 64bit (PHP 7.0.0 + PHP 5.6.16)
GitHub
Windows Kits 10
The folder structures for building
Compiling lemon.exe
Download the source code lemon.c
Compiling
d:\build>cl lemon.c
用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.00.23506 版
版权所有(C) Microsoft Corporation。保留所有权利。
lemon.c
Microsoft (R) Incremental Linker Version 14.00.23506.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:lemon.exe
lemon.obj
d:\build>dir lemon.exe
驱动器 D 中的卷是 工作盘
卷的序列号是 000E-243A
d:\build 的目录
2016/01/14 21:37 209,408 lemon.exe
1 个文件 209,408 字节
0 个目录 24,662,654,976 可用字节
With “phpredis” in ext folder
Configure
d:\build\phpdev\vc14\x86\php-7.0.2-src>configure --disable-all --enable-session --enable-cli --enable-redis --enable-redis-session
Saving configure options to config.nice.bat
Checking for cl.exe ...
Detected compiler MSVC14 (Visual C++ 2015)
Detected 32-bit compiler
Checking for link.exe ... C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN
Checking for nmake.exe ...
Checking for lib.exe ...
Checking for bison.exe ...
Checking for re2c.exe ...
Detected re2c version 0.13.5
Checking for zip.exe ...
Checking for lemon.exe ...
Checking for mc.exe ... C:\Program Files (x86)\Windows Kits\10\bin\x86
Checking for mt.exe ... C:\Program Files (x86)\Windows Kits\10\bin\x86
Enabling multi process build
Build dir: D:\build\phpdev\vc14\x86\php-7.0.2-src\Release_TS
PHP Core: php7ts.dll and php7ts.lib
Checking for wspiapi.h ...
Enabling IPv6 support
Enabling SAPI sapi\cli
Enabling extension ext\date
Enabling extension ext\pcre
Enabling extension ext\reflection
Enabling extension ext\session
Enabling extension ext\spl
Checking for timelib_config.h ... ext/date/lib
Enabling extension ext\standard
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 |
| pcre | static |
| reflection | static |
| session | static |
| spl | static |
| standard | static |
-----------------------
Enabled SAPI:
-------------
| Sapi Name |
-------------
| cli |
-------------
----------------------------------------------
| | |
----------------------------------------------
| Build type | Release |
| Thread Safety | Yes |
| Compiler | MSVC14 (Visual C++ 2015) |
| Architecture | x86 |
| Optimization | PGO disabled |
| Static analyzer | disabled |
----------------------------------------------
Type 'nmake' to build PHP
d:\build\phpdev\vc14\x86\php-7.0.2-src>
You can see there was no error at all.
But when I started compiling...
d:\build\phpdev\vc14\x86\php-7.0.2-src>nmake php_redis.dll
Microsoft (R) 程序维护实用工具 14.00.23506.0 版
版权所有 (C) Microsoft Corporation。 保留所有权利。
NMAKE : fatal error U1073: 不知道如何生成“php_redis.dll”
Stop.
d:\build\phpdev\vc14\x86\php-7.0.2-src>
Which means "Don't know how to compile php_redis.dll".
If I treid configure like this:
d:\build\phpdev\vc14\x86\php-7.0.2-src>configure --disable-all --enable-session --enable-cli --enable-redis --enable-redis-session --enable-redis-igbinary
Saving configure options to config.nice.bat
Checking for cl.exe ...
Detected compiler MSVC14 (Visual C++ 2015)
Detected 32-bit compiler
Checking for link.exe ... C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN
Checking for nmake.exe ...
Checking for lib.exe ...
Checking for bison.exe ...
Checking for re2c.exe ...
Detected re2c version 0.13.5
Checking for zip.exe ...
Checking for lemon.exe ...
Checking for mc.exe ... C:\Program Files (x86)\Windows Kits\10\bin\x86
Checking for mt.exe ... C:\Program Files (x86)\Windows Kits\10\bin\x86
Enabling multi process build
Build dir: D:\build\phpdev\vc14\x86\php-7.0.2-src\Release_TS
PHP Core: php7ts.dll and php7ts.lib
Checking for wspiapi.h ...
Enabling IPv6 support
Enabling SAPI sapi\cli
Enabling extension ext\date
Enabling extension ext\pcre
Enabling extension ext\reflection
Enabling extension ext\session
Enabling extension ext\spl
Checking for timelib_config.h ... ext/date/lib
Enabling extension ext\standard
Checking for igbinary.h ...
Checking for igbinary.h ...
WARNING: redis igbinary support not enabled
Creating build dirs...
Generating files...
Generating Makefile
Generating main/internal_functions.c
[content unchanged; skipping]
Generating main/config.w32.h
Generating phpize
Done.
...
You can find the WARNING message:
Checking for igbinary.h ...
Checking for igbinary.h ...
WARNING: redis igbinary support not enabled
What should I do next?