Compiling PHP on Windows
Created by: Lester Caine, Last modification: 02 Sep 2011 (21:53 BST)
Expanding on the notes provided on 'harddrive is a geek.org'
Initial Install
-
Get Visual Studio 2008 (no matter what version - express, pro or others; all should work) and install it - The free version is available at Microsoft Express Download
First go to the Visual Studio 2008 page from the top bar, 2010 version is useable but not supported, however the current free download only has the x86 compiler.
Select the C++ download which will pull over the web based downloader.
Run the downloader file which will take some time to complete and may appear to stop for an hour or so at a time until everything is download.
All we actually need from this 1Gb+ download is the C compiler - Private setup has archived copy of necessary files. -
Get and install windows sdk 6.1 SDK 7.1 not yet supported.
Installing this to C:\Network\Windows\V6_1 keeps thing in line with the rest of the network development software. - Get a php 5.3 snapshot (do not extract yet!) Add links to SVN and source - want to link this to Eclipse for code management
- create the folder “c:\Network\php-sdk“
- unpack this archive into this directory, there should be one sub-directory called “bin” and one called “script“.
-
An additional package of scripts tidies things up a little more - Helper Scripts
These are copied to the C:\Network\Windows\V6_1 and wrap the normal scripts into single steps. - open the “Microsoft Windows SDK 6.1->CMD Shell”
- phpsetblank {target}
- now extract the snapshot from 3) to C:\Network\php-sdk\{target}\vc9\x64 with your favourite unpacker so that the following directory gets created: C:\php-sdk\{target}\vc9\x64\php5.3-xyz
- run in the windows-sdk-shell:
- cd C:\php-sdk\{target}\vc9\x86\php5.3-xyz
- buildconf
- configure --help, to get an overview of the compiling flags
-
configure --disable-all --enable-apache2-2handler --enable-debug
( For NTS build add --diable-zts to the command line ) - nmake
Compile an extension
- Open a new “Microsoft Windows SDK 6.1->CMD Shell” Command Prompt
- phpset64
- cd C:\php-sdk\{target}\vc9\x86\php5.3-xyz
- buildconf ( To add any new extension directories to the configure file )
-
configure --disable-all --enable-cli --with-{extension}=shared
( For NTS build add --diable-zts to the command line ) - nmake