This article is shared by the Windows compiler php7.2 extremely extended Judy, now share to everyone, a friend in need can refer to the content of this article
PHP has upgraded to 7.2 and intends to start using php7.2, but I often use an extension Judy without an official compiled version ... So I'm going to compile it myself.
Reference article: http://blog.51cto.com/lancelot/2054953 php7.2 Extensions under Windows compilation Memcache
1. Build Environment
(1) There are several important differences in the php7.2 compilation (Windows environment).
1.php7.2 is compiled with VC15 (vs2017)
2.php7.2 's PHP-SDK DSP is not available for download on previous pages (address changed)
3. It's easier to build a build environment.
(2) Concrete environment construction
I. Installing the VC15 compiler
vs2017 the compiler from the IDE, because we just need the compiler so we don't install vs2017 (directly install vs2017 free version)
Http://landinghub.visualstudio.com/visual-cpp-build-tools
Click the download address to download the page below to find the "Visual Studio 2017 build tool " Download installation is OK (when installing the note only need to check the VC compiler related tools can be)
Two. Download PHP-SDK decompression
Https://github.com/Microsoft/php-sdk-binary-tools
Unzip to D:\php_sdk\ (assuming we're ready to use D:\php_sdk\ as the compiled directory)
At this time d:\php_sdk\ should have
Three. Running Phpsdk-vc15-x86.bat in D:\php_sdk\
In the PHP_SDK directory, hold down the SHIFT key and right-click the "Open command line window here"
Run "Phpsdk-vc15-x86.bat" in a command-line window
Note: If you want to compile the 64-bit version, run x64.
Results such as (PHPSDK directory is not the same)
Four. Run phpsdk_buildtree phpDev
At this time d:\php_sdk\ should have a phpdev directory below
five. Download the PHP source code to d:\php_sdk\ phpDEV\VC15\X86\PHP-SRC
d:\php_sdk\phpdev\vc15\x86\ (64 bits for x64) Create php-src directory below
download PHP source extract to php-src directory
at this time d:\php_sdk\ phpdev\vc15\x86\php-src\ directory should look like this (the directory file may be different but this is the root of the source)
Six. Enter the PHP-SRC directory and execute
Command line "CD d:\php_sdk\phpdev\vc15\x86\php-src\" into php-src directory
Command line "PHPsdk_deps--update--branch master" PHP automatically downloads the required dependencies (previously required to manually download PHP-DSP files)
Wait for the download to complete (presumably)
Processing Package zlib-1.2.11-vc15-x64.zipprocessing Package Libsodium-1.0.15-vc15-x64.zipupdates performed Successfully. Old dependencies backed to ' D:\php_sdk\phpdev\vc15\x86\deps.201712260650 '. D:\php_sdk\phpdev\vc15\x86\php-src$
7. Perform "buildconf"
Command line Execution "buildconf"
If you are prompted for a script engine that does not have the file extension ". js"
Baidu "no file extension". js "scripting Engine"
Take this deal, https://blog.csdn.net/ctthuangcheng/article/details/16951361.
Re-execute buildconf
The results are as follows
$ buildconfrebuilding configure.jsnow Run ' Configure--help ' D:\php_sdk\phpdev\vc15\x86\php-src$
8. Compiling PHP
Configure--disable-all--enable-cli--enable-zlib--enable-hash--enable-session--without-gd--with-bz2 -- enable-fd-setsize=2048--enable-sanitizer
Then execute "nmake" to start compiling
After waiting for a few minutes (or 10 minutes), the PHP-SRC directory should be able to find directories such as release_ts (or release_nts or x64\release_ts)
If the compilation is normal, there will be a php.exe file below that proves that the PHP file was compiled successfully.
Run the compiled "php.exe-v" to see if it works
Note: Additional command line Configure parameters
--disable-cgi compiling the Windows version and Php-cgi.exe--disable-zts nts non-thread-safe--enable-shmop=shared compiling PHP in DLL mode SHMOP Extended
2. Compiling the Judy Extension
The above PHP compilation success means that the PHP build environment is completed, and now start compiling Judy extension
1. Download Judy Source
Http://pecl.php.net/package/judy here is Php-judy official website but this source has not been updated for a long time the highest only support php5.6
Https://github.com/esminis/php_pecl_judy This is github with user-upgraded Php-judy test support php7.2
Follow these steps to compile according to the php_pecl_judy instructions
2. Compiling judy.lib
To https://sourceforge.net/projects/judy/download source code
Unzip to any directory
Then right-click on the "Open command-line window here" in Judy-1.0.5\src\
Run C:\Program Files (x86) \microsoft Visual Studio\2017\buildtools\vc\auxiliary\build\vcvars32.bat Note that the path may not be the same
Then run the "build"
Then it compiles a judy.lib
3. Copy the Judy.lib file
One. Rename the Judy.lib file to "LibJudy.lib" to the D:\php_sdk\phpdev\vc15\x86\deps\lib\ directory
Note: It may also be a D:\php_sdk\phpdev\vc15\x86\deps.xxxxxxx\lib\ file (see which Lib has files copied to which directory)
Two. Copy Judy.h to Deps\include below (may be deps.xxxx in the same directory)
4. Copy Phpjudy (https://github.com/esminis/php_pecl_judy) source code to Php-src\ext\judy\
There should be a file under Ext\judy\.
5. Execute in the cmd window that just compiled PHP
Configure--disable-all--enable-cli--enable-zlib--enable-hash--enable-session--without-gd--with-bz2--with-judy= Shared--enable-fd-setsize=2048--enable-sanitizer
(If you close the need to re-execute phpsdk-vc15-x86.bat and then go to the PHP-SRC directory to execute "build")
Then execute NMAKE and then you can see the Php-judy.dll in the Release_ts directory (compilation succeeded)