• git clone https://github.com/Microsoft/php-sdk-binary-tools.git c:\php-sdk
  • cd c:\php-sdk
  • git checkout php-sdk-2.1.9 or later
  • invoke phpsdk-vc15-x64.bat
  • phpsdk_buildtree phpmaster
  • git clone https://github.com/php/php-src.git && cd php-src, or fetch a zipball
  • phpsdk_deps --update --branch master, use phpsdk_deps --update --branch X.Y for a non master branch
  • do the build, eg. buildconf && configure --enable-cli && nmake

Windows编译PHP拓展

1.离线下载并安装Build Tools(对应Visual Studio 2017)

下载连接:vs_buildtools.exe
离线下载脚本:

vs_buildtools.exe --layout E:\VS2017BuildTools --add Microsoft.VisualStudio.Workload.VCTools --lang zh-CN

2. 下载,解压PHP-SDK工具包

https://github.com/Microsoft/php-sdk-binary-tools

3. PHP-SDK配置,加载

# 命令行进入解压路径,按自己需求执行对应的批处理脚本
>phpsdk-vc15-x64.bat
$> phpsdk_buildtree phpdev

4. 下载PHP-SDK编译依赖组件

$> phpsdk_deps -u
# 或手工下载([依赖下载链接](https://windows.php.net/downloads/php-sdk/deps))并解压至deps目录
# 下载目录对应当前上级目录文件名

5. 下载,复制PHP源码,下载,复制扩展源码。

  • 可在当前目录下载,解压多个PHP版本的源码。
  • vc## 编译工具版本(eq vc15),x## CPU版本 (x86 or x64)
  • 解压复制PHP源码至phpdev\vc##\x##\php-7.3.7-src
  • 解压复制扩展源码至phpdev\vc##\x##\php-7.3.7-src\ext或phpdev\vc##\x##\pecl
  • beast扩展需要复制win95nt.hphp-7.3.7-src\main目录。(此文件建议下载一个PHP7.1x的源码,在main目录。)

务必修改beast源码文件config.w32,替换为如下内容。源码有错误,作者后期新加的代码漏了execute-normal-script配置信息:

// $Id$
// vim:ft=javascript // If your extension references something external
ARG_WITH("beast", "for beast support", "yes,shared"); ARG_ENABLE("beast", "enable beast support", "yes,shared"); ARG_ENABLE("beast-debug", "enable beast debug mode", "no"); ARG_ENABLE("execute-normal-script", "Enable execute normal PHP script", "yes"); if (PHP_BEAST != "no") {
if (PHP_BEAST_DEBUG != "no") {
AC_DEFINE('BEAST_DEBUG_MODE', 1, 'Debug support in beast');
}
if (PHP_EXECUTE_NORMAL_SCRIPT != "no") {
AC_DEFINE('BEAST_EXECUTE_NORMAL_SCRIPT', 1, [ ]);
} EXTENSION("beast", "beast.c aes_algo_handler.c des_algo_handler.c base64_algo_handler.c beast_mm.c spinlock.c cache.c beast_log.c global_algo_modules.c header.c networkcards.c tmpfile_file_handler.c file_handler_switch.c shm.c", true);
}

6. 编译扩展

$>cd php-7.3.7-src
$>buildconf
$>configure --help #查找编译扩展关键字,确定配置参数
# 线程安全编译
$>configure --disable-all --enable-cli --without-beast --enable-execute-normal-script=yes --disable-beast=shared && nmake
# 非线程安全编译
$>configure --disable-zts --disable-all --enable-cli --without-beast --enable-execute-normal-script=yes --disable-beast=shared && nmake

重新编译脚本

# Recompile after you have done some changes
1. Clean up old compiled binaries
nmake clean
2. If you need to update the 'configure' script
buildconf --force
3. Create your makefile: see release
configure --disable-all --enable-cli --enable-$remains
4. Compile
nmake

引用资源

  1. 在windows10下php7.3+编译phalcon扩展 https://www.jianshu.com/p/9dca99f7d4a9
  2. Windows编译PHP7.2拓展 https://segmentfault.com/a/1190000016011547
  3. https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2
 
 

jenawant commented on 4 Dec 2019

你直接在vs里面编译就好了

你好,请教一下,目前PHP用的版本是5.6,应该如何生成dll呢?试了好多网上的方案,都不行,还请指导一下 ,谢谢。

 
 

Refactoring commented on 4 Dec 2019

@jenawant
5.6我这也没有成功,放弃5.6了。我编译环境太多,最后再没折腾。
服务器自己有权折腾,就升级吧,同样的代码7.x性能好的不得了(开启opcache)。

 
 

jenawant commented on 5 Dec 2019 •

edited 

@Refactoring

感谢回复,基于你的方案,然后参考PHP官方文档,在5.6.40下编译成功了,谢谢。
接受你的建议,接下来,要搞PHP7的版本。

引用资源:http://ishere.cn/2019/12/05/windows10-compile-php-extension.html

php beast windows编译教程的更多相关文章

  1. DevExpress Components16.2.6 Source Code 重编译教程

    DevExpress 是一个比较有名的界面控件套件,提供了一系列优秀的界面控件.这篇文章将展示如何在拥有源代码的情况下,对 DevExpress 的程序集进行重新编译. 特别提示:重编译后,已安装好的 ...

  2. gRPC编译教程

    windows平台的编译 一.编译openssl ① 安装perl(可以使用ActivePerl),执行perl Configure VC-WIN64A no-asm .在这里解释一下参数含义,VC- ...

  3. CM12同步源码及编译教程

    同时提供基于安卓5.0的MKL魔趣猪扒饭编译教程~[玩机组出品]魔趣猪扒饭MKL50.1编译教程http://www.oneplusbbs.com/forum.php?mod=viewthread&a ...

  4. OGRE 2.1 Windows 编译

    版权所有,转载请注明链接 OGRE 2.1 Windows 编译 环境: Windows 7 64Bit Visual Studio 2012 OGRE 2.1 CMake 2.8.12.1 OGRE ...

  5. Android反编译教程

    本文摘自 http://blog.csdn.net/ithomer/article/details/6727581 本文Android反编译教程,测试环境: Win7 Ultimate x64 Ubu ...

  6. Windows编译ejabberd

    Windows编译ejabberd(金庆的专栏)安装 erlang OTP. 添加路径到 PATH, 使 erl 可以运行.git clone ejabberd安装 rebar:git clone g ...

  7. Windows API教程文件系统

    本篇文章主要介绍了"Windows API教程文件系统",主要涉及到Windows API教程文件系统方面的内容,对于Windows API教程文件系统感兴趣的同学可以参考一下. ...

  8. MySQL 8.0.12 基于Windows 安装教程(超级详细)

    MySQL 8.0.12 基于Windows 安装教程(超级详细) (一步一步来,装不了你找我!) 本教程仅适用Windows系统,如果你原本装了没装上,一定要先删除原本的数据库,执行:mysqld ...

  9. 【转载】OGRE 2.1 Windows 编译

    OGRE 2.1 Windows 编译 环境: Windows 7 64Bit Visual Studio 2012 OGRE 2.1 CMake 2.8.12.1 OGRE: OGRE官方推出了最新 ...

随机推荐

  1. JMeter 接口测试 自动生成签名机制

    在进行接口测试时,遇到接口进行了签名校验,为实现自动生成签名,经过一点研究终于成功. 首先,需要从前端获取 签名加密包  XXXsign.jar..  建议将该jar包放在 jmeter lib 目录 ...

  2. es--es分词的一些分析技巧

    查看某个字段的分词结果 POST /index/tyhpe/id/_termvectors?fields=fields_name 例如:http://localhost:9200/prod_membe ...

  3. websocket聊天室

    目录 websocket方法总结 群聊功能 基于websocket聊天室(版本一) websocket方法总结 # 后端 3个 class ChatConsumer(WebsocketConsumer ...

  4. Jquery的$.get(),$.post(),$.ajax(),$.getJSON()用法详细解读

    1.$.get $.get()方法使用GET方式来进行异步请求,它的语法结构为: $.get( url [, data] [, callback] ) 解释一下这个函数的各个参数: url:strin ...

  5. Angular input / ion-input ion-searchbar 实现软件盘换行 改 搜索 并且触发搜索方法 Android iOS适用

    Angular 实现软件盘 换行 改 搜索 并且除非 搜索方法:    Form 必须有 action="javascript: return true;”   input / ion-in ...

  6. Levenshtein算法-比较两个字符串之间的相似度

    package com.sinoup.util;/** * Created by Administrator on 2020-4-18. */ /** * @Title: * @ProjectName ...

  7. 带权值的LCA

    例题:http://poj.org/problem?id=1986 POJ1986 Distance Queries Language: Default Distance Queries Time L ...

  8. Ubuntu安装Elasticsearch6.3

    本文使用的 Ubuntu 版本信息: Distributor ID: Ubuntu Description: Ubuntu LTS Release: 16.04 Codename: xenial 1. ...

  9. mapstruct使用详解

    我们都知道,随着一个工程的越来越成熟,模块划分会越来越细,其中实体类一般存于 domain 之中,但 domain 工程最好不要被其他工程依赖,所以其他工程想获取实体类数据时就需要在各自工程写 mod ...

  10. 多线程高并发编程(6) -- Semaphere、Exchanger源码分析

    一.Semaphere 1.概念 一个计数信号量.在概念上,信号量维持一组许可证.如果有必要,每个acquire()都会阻塞,直到许可证可用,然后才能使用它.每个release()添加许可证,潜在地释 ...