Open the command prompt and enter the build directory:
cd c:\php-sdk\
Set up the build environment variables:
bin\phpsdk_setvars.bat
Change directory to the location of your PHP source code, e.g.
cd C:\php-sdk\phpdev\vc11\x86\php-5.6.4-src
Run:
buildconf
To get an overview of the compiling flags:
configure --help
Create your configure command:
configure --disable-all --enable-cli --enable-$remains
To build PHP, run:
nmake
If you want the resulting PHP builds and extensions to be zipped, after 'nmake' also run:
nmake snap
The compiled PHP is now under “C:\php-sdk\phpdev\vcXX\x86\php-source-directory\Release_TS”. If you ran 'nmake snap' the zip file will also be here.
If you compiled with “--disable-zts” the compiled PHP will be under “C:\php-sdk\phpdev\vcXX\x86\php-source-directory\Release”
If compiling PHP 5.4, open the “Windows SDK 6.1 shell” and execute the following command in it:
If compiling PHP 5.5 or 5.6 open the “VS2012 x86 Native Tools Command Prompt”
If compiling PHP 7.0+ open either the “VS2015 x64 Native Tools Command Prompt” or the “VS2015 x86 Native Tools Command Prompt”.
All commands in the rest of this document should be run in the appropriate command prompt.
Setup the build directory
This should be done only once before building PHP.
Create the build directory c:\php-sdk
Unpack the binary tools archive into this directory, it should contain three sub-directories: bin, script and share
Open the command prompt and enter the build directory:
Run the buildtree batch script which will create the desired directory structure:
bin\phpsdk_buildtree.bat phpdev
The buildtree script hasn't been updated for newer versions of VC++ so:
If compiling for VC11: copy C:\php-sdk\phpdev\vc9 to C:\php-sdk\phpdev\vc11
If compiling for VC14: copy C:\php-sdk\phpdev\vc9 to C:\php-sdk\phpdev\vc14
Extract the PHP source code to C:\php-sdk\phpdev\vc##\x##, where:
vc## is the compiler version you are using (vc9, vc11 or vc14)
x## is your architecture (x86 or x64)
For example: C:\php-sdk\phpdev\vc11\x86\php-5.6.4-src
In the same directory where you extracted the PHP source there is a deps directory. Here you will need to extract the libraries required to build PHP, which you downloaded in the perevious step (the deps-*.7z archive).
Recompile after you have done some changes
Clean up old compiled binaries
nmake clean
If you need to update the 'configure' script
buildconf --force
Create your makefile: see release
configure --disable-all --enable-cli --enable-$remains
if above dont work try:
configure --disable-all --enable-cli
Compile
nmake