search
HomeBackend DevelopmentPHP TutorialCompile php7.2 under windows and extend judy

Compile php7.2 under windows and extend judy

Apr 08, 2018 am 09:21 AM
phpwindows

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
$

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
$

8. Compile php

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

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 扩展

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


(如果关闭了 需要重新 执行 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
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
PHP Dependency Injection Container: A Quick StartPHP Dependency Injection Container: A Quick StartMay 13, 2025 am 12:11 AM

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Dependency Injection vs. Service Locator in PHPDependency Injection vs. Service Locator in PHPMay 13, 2025 am 12:10 AM

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHP performance optimization strategies.PHP performance optimization strategies.May 13, 2025 am 12:06 AM

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHP Email Validation: Ensuring Emails Are Sent CorrectlyPHP Email Validation: Ensuring Emails Are Sent CorrectlyMay 13, 2025 am 12:06 AM

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl

How to make PHP applications fasterHow to make PHP applications fasterMay 12, 2025 am 12:12 AM

TomakePHPapplicationsfaster,followthesesteps:1)UseOpcodeCachinglikeOPcachetostoreprecompiledscriptbytecode.2)MinimizeDatabaseQueriesbyusingquerycachingandefficientindexing.3)LeveragePHP7 Featuresforbettercodeefficiency.4)ImplementCachingStrategiessuc

PHP Performance Optimization Checklist: Improve Speed NowPHP Performance Optimization Checklist: Improve Speed NowMay 12, 2025 am 12:07 AM

ToimprovePHPapplicationspeed,followthesesteps:1)EnableopcodecachingwithAPCutoreducescriptexecutiontime.2)ImplementdatabasequerycachingusingPDOtominimizedatabasehits.3)UseHTTP/2tomultiplexrequestsandreduceconnectionoverhead.4)Limitsessionusagebyclosin

PHP Dependency Injection: Improve Code TestabilityPHP Dependency Injection: Improve Code TestabilityMay 12, 2025 am 12:03 AM

Dependency injection (DI) significantly improves the testability of PHP code by explicitly transitive dependencies. 1) DI decoupling classes and specific implementations make testing and maintenance more flexible. 2) Among the three types, the constructor injects explicit expression dependencies to keep the state consistent. 3) Use DI containers to manage complex dependencies to improve code quality and development efficiency.

PHP Performance Optimization: Database Query OptimizationPHP Performance Optimization: Database Query OptimizationMay 12, 2025 am 12:02 AM

DatabasequeryoptimizationinPHPinvolvesseveralstrategiestoenhanceperformance.1)Selectonlynecessarycolumnstoreducedatatransfer.2)Useindexingtospeedupdataretrieval.3)Implementquerycachingtostoreresultsoffrequentqueries.4)Utilizepreparedstatementsforeffi

See all articles

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

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.