Home >Backend Development >PHP Tutorial >Compile php7.2 under windows and extend judy
The content shared in this article is to compile php7.2 under windows and extend Judy. Now I share it with everyone. Friends in need can refer to the content of this article.
I plan to upgrade php to 7.2. I use php7.2, but there is no official compiled version of Judy, an extension I often use...so I plan to compile it myself..
Reference article: http://blog.51cto .com/lancelot/2054953 Compiling php7.2 under windows to extend memcache
1.php7.2 is compiled using vc15 (vs2017)
2.php7.2’s php-sdk dsp is no longer available for download on the previous page (the address has been changed)
3. Building the compilation environment is easier.
vs2017 separates the compiler and ide. Because we only need the compiler, we don’t need to install vs2017 (you can also install the free version of vs2017 directly)
http://landinghub .visualstudio.com/visual-cpp-build-tools
Click the download address to go to the download page and find "Visual Studio 2017 Build Tool" below to download Just install it (when installing, please note that you only need to check the box that only requires vc compilation related tools)
https://github.com/ Microsoft/php-sdk-binary-tools
Extract to d:\php_sdk\ (assuming we plan to use d:\php_sdk\ as the compilation directory)
At this time d:\ php_sdk\ There should be
in d:\php_sdk\ and press and hold in the php_sdk directory Right-click with shift key and "Open command line window here"
Run "phpsdk-vc15-x86.bat" in the command line window
Note: If you want to compile the 64-bit version, run x64 ,
The result is as shown below (the phpsdk directory is different)
At this time there should be a phpdev directory under d:\php_sdk\
Create the php-src directory under d:\php_sdk\phpdev\vc15\x86\ (64-bit is x64)
Download the php source code and extract it to the php-src directory
At this time d:\php_sdk\phpdev\vc15\x86\php-src\ directory should be as follows (directory The files may be different but this is the root directory of the source code)
d:\php_sdk\phpdev\vc15\x86\php-src\" to enter the php-src directory
Command line "phpsdk_deps --update --branch master" PHP will automatically download the required dependency packages (previously, you needed to download the php-dsp file manually)
Wait for the download to complete (Approximately as shown below)Processing package zlib-1.2.11-vc15-x64.zip Processing package libsodium-1.0.15-vc15-x64.zip Updates performed successfully. Old dependencies backed up into 'D:\php_sdk\phpdev\vc15\x86\deps.201712260650'. D:\php_sdk\phpdev\vc15\x86\php-src $7. Execute "
buildconf"
If you are prompted that there is no script engine with the file extension ".js"
Baidu "There is no script engine with the file extension ".js"" Follow this https://blog. csdn.net/ctthuangcheng/article/details/16951361buildconf
The results are as follows
$ buildconf Rebuilding configure.js Now run 'configure --help' D:\php_sdk\phpdev\vc15\x86\php-src $8. Compile php
configure --disable-all --enable-cli --enable-zlib --enable-hash --enable-session --without-gd --with-bz2 --enable-fd-setsize=2048 --enable-sanitizer
nmake" to start compilation
After waiting for a few minutes (or 10 minutes), you should be able to find Release_TS in the php-src directory (Or Release_NTS or x64\Release_TS) Such a directoryIf the compilation is normal, there will be a php.exe file below to prove that the php file is compiled successfully.Run the compiled "php.exe - v" Check whether it is running normallyNote: Other command line configure parameters--disable-cgi 编译出 windows 版本和 php-cgi.exe --disable-zts nts 非线程安全 --enable-shmop=shared 以dll 方式编译 php shmop 扩展2. Compile judy extensionThe successful compilation of the above php means that the php compilation environment is completed, now Start compiling judy extension
http://pecl.php.net/package/judy 这里是php-judy 官网 但是这个源码好久没有更新了 最高只支持php5.6
https://github.com/esminis/php_pecl_judy 这个是github 上面 有用户升级过的php-judy 测试支持php7.2
根据 php_pecl_judy 的说明按如下步骤编译
到https://sourceforge.net/projects/judy/ 下载 源码
解压到任意目录
然后 在 judy-1.0.5\src\ 中右键 shift 点击 "在此处打开命令行窗口"
运行 "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars32.bat" 注意路径可能不一样
然后运行 "build"
然后会编译出一个 judy.lib
一.重命名 judy.lib 文件为 "libJudy.lib" 复制到 D:\php_sdk\phpdev\vc15\x86\deps\lib\ 目录下
注释:也有可能是 D:\php_sdk\phpdev\vc15\x86\deps.xxxxxxx\lib\ 文件(看看哪个lib下面有 文件 就拷贝到哪个目录)
二.复制 judy.h 到deps\include 下面(同上 目录可能 为deps.xxxx )
在 ext\judy\ 下面应该有文件
configure --disable-all --enable-cli --enable-zlib --enable-hash --enable-session --without-gd --with-bz2 --with-judy=shared --enable-fd-setsize=2048 --enable-sanitizer
(如果关闭了 需要重新 执行 phpsdk-vc15-x86.bat 然后进入 php-src目录 执行 "build")
然后执行 nmake 然后就可以在 Release_TS 目录看见 php-judy.dll了(编译成功)
相关推荐:
The above is the detailed content of Compile php7.2 under windows and extend judy. For more information, please follow other related articles on the PHP Chinese website!