This 1st step will prove your environment setup is correct. Make sure you can finish this step successfully before going to the 2nd step.

I. Environment and related Packages:

  1. Microsoft Visual C++ 2008 Express Edition with SP1:
    1. Another name is MSVC9. Download it at
    2. The recent PHP binary packages are compiled in MSVC9 environment. This tutorial is for MSVC9. Please don't use the Microsoft Visual C++ 2010 or later, which will not be compatible with the current PHP Windows Binaries.
    3. If you want MSVC6 environment, you need to install the Microsoft Visual C++ 6.0 and Windows Server 2003 SP1 Platform SDK at
  2. Windows SDK 6.1:
    1. You must use the Windows SDK instead of the SDK included in above MSVC9. For building PHP5.3, you need to use Windows SDK 6.1 (Windows SDK for Windows Server 2008 and .NET Framework 3.5, For more information regarding the SDK, please see
  3. PHP SDK Binary Tools:
    1. Download a zip file from What I downloaded on 8/7/2012 was
    2. Unzip it, rename and move the folder to C drive. The file structure will look like the following screenshot:
  4. Dependable libs:
    1. Download a zip file from What I downloaded was deps-5.4-vc9-x86.7z on 8/3/2012.
    2. Create directory tree like: C:\php-sdk\php54dev\vc9\x86
    3. Unzip the zip file and move the deps directory under C:\php-sdk\php54dev\vc9\x86. So, it will be like the following screenshot:
  5. PHP5.4 Sources:
    1. Download the source code from (click the "Download source code" link)
    2. After unzip move it under C:\php-sdk\php54dev\vc9\x86\, You can name this folder to what you like. Mine is as below:

      Now you are ready to compile!

II. Compile:

  1. Set the environment: Open the “Windows SDK 6.1 Shell” (it’s available from the start menu group) and execute the following commands in it. If you are using 64 bit system, don't try to change the parameter to /x64, otherwise during the make period, you will see tons of WARNING.
    set PATH=D:\php-sdk\bin;%PATH%
    setenv /x86 /xp /release
    cd c:\php-sdk\

    You will get the following screen:
  2. Build the configuration file for creating the make file:
    cd C:\php-sdk\php54dev\vc9\x86\php-5.4.5-src

    If you get an error like:
    Input Error: There is no script engine for file extension ".js".

    You need to edit the buildconf.bat file as below:

    Run the buildconf again:

    You will get the following screen:

    A new configuration file: configure.js will be created as below:

    Now, you can check the configuration options:
    configure --help

    If you get the following error again:
    Input Error: There is no script engine for file extension ".js".

    Please edit the configure.bat file and add /e:jscript after the /nologo.

    Run the configure --help again:
    configure --help

    If you can get the following screen, it means you successfully created the configuration file:
  3. Create the make file:
    configure --disable-snapshot-build --disable-debug-pack --disable-ipv6 --disable-zts --disable-isapi --disable-nsapi --without-t1lib --without-mssql --without-pdo-mssql --without-pi3web --without-enchant --enable-com-dotnet --with-mcrypt=static --disable-static-analyze

    If you run it successfully, you will see the screen as below:

  4. Make the binary package by typing nmake:

    Wait for a while, if you see this result, you succeeded.

    You will also find a new "Release" directory appeared under C:\php-sdk\php54dev\vc9\x86\php-5.4.5-src as below:
  5. Test the PHP Binary files:
    # Check PHP Version
    C:\php-sdk\php54dev\vc9\x86\php-5.4.5-src\Release\php.exe -v
    # It is same to phpinfo()
    C:\php-sdk\php54dev\vc9\x86\php-5.4.5-src\Release\php.exe -i
    # Check PHP modules
    C:\php-sdk\php54dev\vc9\x86\php-5.4.5-src\Release\php.exe -m

    If you can get the results properly, you are all done!

标签: PHP, SDK, MSVC9, PECL, extension