How to Build Tools for PHP 5 for Windows

PHP is an open-source programming language used by millions of users. Anyone can download the source code to look at or to build. By building the PHP source code on your own, you can have a private, custom version of the PHP language in which you might add extra commands or optimizations. Building the source on a Windows machine requires just a few free tools that you may already have on your computer if you are a programmer.

Things You'll Need

  • Microsoft Visual Studio C++ 2008
  • Windows SDK for Windows Server 2008
  • .NET Framework 3.5
Show More

Instructions

    • 1

      Copy the file "C:\Program Files\Microsoft SDKs\Windows\v6.1\Include\WinResrc.h" to the new location "C:\Program Files\Microsoft SDKs\Windows\v6.1\Include\winres.h."

    • 2

      Create a new folder called "C:\work."

    • 3

      Download the PHP Windows Build Tools (see Resources) and unzip the contents into the "c:\work" directory.

    • 4

      Create another directory called "C:\usr\local\lib."

    • 5

      Copy the file "C:\work\win32build\bin\bison.simple" into the new folder from the previous step.

    • 6

      Download the Windows DNS Resolver Library (see Resources). Unzip the contents into "C:\work."

    • 7

      Open "C:\work\bindlib_w32\bindlib.dsw" with Visual Studio. When asked whether to update the project, choose "Yes."

    • 8

      Choose either the "Debug" or "Release" configuration in the top toolbar of Visual Studio, then click "Build > Build Solution" from the top menu.

    • 9

      Obtain a copy of the PHP source (see Resources) and unzip it into the "C:\work" folder.

    • 10

      Open a command prompt from the Visual Studio 2008 Command Prompt shortcut in your Windows "Start" menu.

    • 11

      Type the following command into the open command prompt:

      set "PATH=C:\work\win32build\bin;%PATH%"

    • 12

      Navigate to the following directory by typing this command into the command prompt:

      cd C:\work\php-5.2.5

    • 13

      Type the following commands into the command prompt, pressing "Enter" after each one:

      cscript /nologo win32\build\buildconf.js

      cscript /nologo configure.js --disable-all --enable-cli --enable-cgi --enable-object-out-dir=.. --disable-ipv6

      nmake

    • 14

      Navigate to either "C:\work\Debug_TS" or "C:\work\Release_TS," depending on which option you chose in Step 8. There will be a newly built "php.exe" file, which is the executable responsible for interpreting and executing any and all PHP code.

Tips & Warnings

  • You can use any version of Visual Studio beginning from 2005; you can even use Microsoft Visual C++ 6.0.

Related Searches:

References

Resources

Comments

You May Also Like

Related Ads

Featured