search
Homephp教程php手册Windows下源码编译PHP

Windows下源码编译PHP

Jun 13, 2016 am 10:33 AM
microphpwindowsDownthingPreparestartSource codecompileneed

seaprince.cn

开始前准备

开始之前,你需要准备如下东西:

  1. Microsoft Visual C++, 建议Visual C++ 2008, 速成版或专业版都可以。
  2. Windows SDK,下载地址:aspx?FamilyId=F26B1AA4-741A-433A-9BE5-FA919850BDBF&displaylang=en">http://www.microsoft.com/downloads/details.aspx?FamilyId=F26B1AA4-741A-433A-9BE5-FA919850BDBF&displaylang=en 不建议用那个网络安装,慢死,还不知道什么时候能完。还有就是建议全部安装。
  3. 其他工具,下载地址:http://pecl2.php.net/downloads/php-windows-builds/php-libs/binary-tools.zip

编译步骤

  1. 下载并安装VC++ 2008,并安装。
  2. 安装windows sdk 6.1
  3. 下载php5.3,下载地址:http://cn.php.net/get/php-5.3.0.tar.bz2/from/this/mirror
  4. 创建文件夹,比如C:php-sdk
  5. 把上面第三步下载的包解压到这里,解压完时C:php-sdk里应该有两个子目录bin, script
  6. 在开始菜单处打开Microsoft Windows SDK v6.1/CMD Shell,输入命令:
    setenv /x86 /xp /release
    cd c:php-sdk
    binphpsdk_setvars.bat
    binphpsdk_buildtree.bat php53dev
  7. 上一步会创建一些目录。进入vc9x86,把php5.3.0解压在这里,解压后目录结构:vc9x86php5.3.0
  8. 在WIN-SDK的命令行下输入:
    cd C:php-sdkphp53devvc9x86php5.3.0
    buildconf
  9. 到了这一步,就和linux下差不多了,你可以看一下编译的选项帮助:
    configure –help
  10. 好,我们来一个最小化的编译:
    configure –disable-all –enable-cli
    nmake
  11. 这一步在php wiki上是没有问题,但由于我们是中文环境,会报下面的错误:
  12. 用Editplus打开extstandardrowscap.c这个文件,

    选是,并选择Western European (Windows)
    然后另存为UTF-8编码。
  13. 重新nmake编译,然后用nmake snap编译成最终二进制包。二进制包在php-5.3.0Release_TS下。可能的名字是php-5.3.0-Win32-VC9-x86.zip
  14. 测试一下:

下一篇文章再写怎么编译pecl扩展。

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

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 Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.