Table of Contents
1. Compilation environment setup
(1) There are several important differences in the compilation of php7.2 (windows environment).
(2) Building the specific environment
1. Install the vc15 compiler
2. Download php-sdk and unzip
3. Run phpsdk-vc15-x86.bat
5. Download the php source code and extract it to d:\php_sdk\phpdev\vc15\x86\php-src" >5. Download the php source code and extract it to d:\php_sdk\phpdev\vc15\x86\php-src
"" >buildconf"
configure --disable-all --enable-cli --enable-zlib --enable-hash --enable-session --without-gd --with-bz2  --enable-fd-setsize=2048 --enable-sanitizer
Copy after login
" >
configure --disable-all --enable-cli --enable-zlib --enable-hash --enable-session --without-gd --with-bz2  --enable-fd-setsize=2048 --enable-sanitizer
Copy after login
1.下载judy源码
2.编译judy.lib
3.拷贝judy.lib文件
4.复制 phpjudy(https://github.com/esminis/php_pecl_judy)源码到 php-src\ext\judy\
5.在刚刚编译php的cmd窗口执行 
Home Backend Development PHP Tutorial Compile php7.2 under windows and extend judy

Compile php7.2 under windows and extend judy

Apr 08, 2018 am 09:21 AM
php windows

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. Compilation environment setup

(1) There are several important differences in the compilation of php7.2 (windows environment).

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.


(2) Building the specific environment

1. Install the vc15 compiler


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)

2. Download php-sdk and unzip

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


3. Run phpsdk-vc15-x86.bat

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)


##4. Run php

sdk_buildtree php dev

At this time there should be a phpdev directory under d:\php_sdk\

5. Download the php source code and extract it to d:\php_sdk\phpdev\vc15\x86\php-src

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)


# 6. Enter php- src directory, execute the

command line "cd

d:\php_sdk\phpdev\vc15\x86\php-src\" to enter the php-src directory

Command line "php

sdk_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
$
Copy after login

7. Execute "

buildconf"

Command line execution"

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/16951361


Re-execute

buildconf

The results are as follows

$ buildconf
Rebuilding configure.js
Now run 'configure --help'

D:\php_sdk\phpdev\vc15\x86\php-src
$
Copy after login

8. Compile php

configure --disable-all --enable-cli --enable-zlib --enable-hash --enable-session --without-gd --with-bz2  --enable-fd-setsize=2048 --enable-sanitizer
Copy after login

and then execute "

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 directory

If 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 normally

Note: Other command line configure parameters

--disable-cgi   编译出 windows 版本和 php-cgi.exe
--disable-zts   nts 非线程安全
--enable-shmop=shared   以dll 方式编译 php shmop 扩展
Copy after login

2. Compile judy extension

The successful compilation of the above php means that the php compilation environment is completed, now Start compiling judy extension

1.下载judy源码

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 的说明按如下步骤编译

2.编译judy.lib

到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

3.拷贝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 )

4.复制 phpjudy(https://github.com/esminis/php_pecl_judy)源码到 php-src\ext\judy\

在 ext\judy\ 下面应该有文件


5.在刚刚编译php的cmd窗口执行

configure --disable-all --enable-cli --enable-zlib --enable-hash --enable-session --without-gd --with-bz2 --with-judy=shared --enable-fd-setsize=2048 --enable-sanitizer
Copy after login


(如果关闭了 需要重新 执行 phpsdk-vc15-x86.bat 然后进入 php-src目录 执行 "build")

然后执行 nmake 然后就可以在 Release_TS 目录看见 php-judy.dll了(编译成功)

相关推荐:

PHP编译安装过程以及各编译参数配置详解

PHP7.1安装yaf扩展的方法


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!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1253
24
The Compatibility of IIS and PHP: A Deep Dive The Compatibility of IIS and PHP: A Deep Dive Apr 22, 2025 am 12:01 AM

IIS and PHP are compatible and are implemented through FastCGI. 1.IIS forwards the .php file request to the FastCGI module through the configuration file. 2. The FastCGI module starts the PHP process to process requests to improve performance and stability. 3. In actual applications, you need to pay attention to configuration details, error debugging and performance optimization.

What happens if session_start() is called multiple times? What happens if session_start() is called multiple times? Apr 25, 2025 am 12:06 AM

Multiple calls to session_start() will result in warning messages and possible data overwrites. 1) PHP will issue a warning, prompting that the session has been started. 2) It may cause unexpected overwriting of session data. 3) Use session_status() to check the session status to avoid repeated calls.

How to handle high DPI display in C? How to handle high DPI display in C? Apr 28, 2025 pm 09:57 PM

Handling high DPI display in C can be achieved through the following steps: 1) Understand DPI and scaling, use the operating system API to obtain DPI information and adjust the graphics output; 2) Handle cross-platform compatibility, use cross-platform graphics libraries such as SDL or Qt; 3) Perform performance optimization, improve performance through cache, hardware acceleration, and dynamic adjustment of the details level; 4) Solve common problems, such as blurred text and interface elements are too small, and solve by correctly applying DPI scaling.

Composer: Aiding PHP Development Through AI Composer: Aiding PHP Development Through AI Apr 29, 2025 am 12:27 AM

AI can help optimize the use of Composer. Specific methods include: 1. Dependency management optimization: AI analyzes dependencies, recommends the best version combination, and reduces conflicts. 2. Automated code generation: AI generates composer.json files that conform to best practices. 3. Improve code quality: AI detects potential problems, provides optimization suggestions, and improves code quality. These methods are implemented through machine learning and natural language processing technologies to help developers improve efficiency and code quality.

What is the significance of the session_start() function? What is the significance of the session_start() function? May 03, 2025 am 12:18 AM

session_start()iscrucialinPHPformanagingusersessions.1)Itinitiatesanewsessionifnoneexists,2)resumesanexistingsession,and3)setsasessioncookieforcontinuityacrossrequests,enablingapplicationslikeuserauthenticationandpersonalizedcontent.

How to uninstall MySQL and clean residual files How to uninstall MySQL and clean residual files Apr 29, 2025 pm 04:03 PM

To safely and thoroughly uninstall MySQL and clean all residual files, follow the following steps: 1. Stop MySQL service; 2. Uninstall MySQL packages; 3. Clean configuration files and data directories; 4. Verify that the uninstallation is thorough.

H5: Key Improvements in HTML5 H5: Key Improvements in HTML5 Apr 28, 2025 am 12:26 AM

HTML5 brings five key improvements: 1. Semantic tags improve code clarity and SEO effects; 2. Multimedia support simplifies video and audio embedding; 3. Form enhancement simplifies verification; 4. Offline and local storage improves user experience; 5. Canvas and graphics functions enhance the visualization of web pages.

How to use MySQL functions for data processing and calculation How to use MySQL functions for data processing and calculation Apr 29, 2025 pm 04:21 PM

MySQL functions can be used for data processing and calculation. 1. Basic usage includes string processing, date calculation and mathematical operations. 2. Advanced usage involves combining multiple functions to implement complex operations. 3. Performance optimization requires avoiding the use of functions in the WHERE clause and using GROUPBY and temporary tables.

See all articles