It is an interesting thing to build PHP source on a Windows Platform. It is extremely useful to build PHP source with various options specially if you wish to write a php extension. Here are some interesting tips on how you can build PHP source on a windows platform.
First you need to download the following dependencies.
1. You need to have visual studio or windows platform SDK install on you machine in order to have the required compiler and build tools.
2. You need to download the PHP build dependencies.
These include
1. Binary tools - Essential
2. Libxml2 - Optional
3. Iconv Optional
4. Zlib - Optional
5. Apache or other web server that you intend to build modules.
6. PHP Source - Essential
7. bindlib-cvs-vc8 - Essential
Most of these tools can be downloaded from here.
Once you have downloaded these tools, you are ready to build PHP from source.
First unzip all these tools to a directory.
Next, open visual studio command prompt and add binary-tools\bin directory to the path.
Now, go to the PHP source extract directory and type,
buildconf.bat
Then run
cscript /nologo configure.js --help
You will see a large number of options as shown above.
Next open the config.nice.bat file located in the php source directory and add necessary configure options for your build
Here are my configuration options
cscript /nologo configure.js "--with-extra-includes=E:\phpbuild\bindlib-cvs-vc8\include;E:\Apache22\include;E:\phpbuild\iconv-1.9.2.win32\include;E:\phpbuild\libxml2-2.6.30.win32\include;E:\phpbuild\zlib-1.2.3.win32\include"
"--with-extra-libs=E:\phpbuild\iconv-1.9.2.win32\lib;E:\phpbuild\libxml2-2.6.30.win32\lib;E:\phpbuild\zlib-1.2.3.win32\lib;E:\Apache22\lib;E:\phpbuild\bindlib-cvs-vc8\lib"
"--enable-debug" "--enable-apache2-2handler" %*
Here I am using the option --with-extra-includes to specify the include paths of the dependency libraries. Similarly --with-extra-libs is used to specify the library path.
I use the options --enable-debug to make it a debug build.
Now run config.nice.bat file.
Next you can try nmake on the command line and it will build the PHP Source.
Cool, it worked for me, thanks alot.
ReplyDeleteI just wanna stess on using the command prompt which comes with visual studio, since it prepares the environment variables and avoid funny problems such as:
http://social.msdn.microsoft.com/forums/en-US/Vsexpressvc/thread/2e7ab115-d408-4262-9b06-ec61101c8802/
have fun
Use -disable-ipv6 flag to avoid the error
ReplyDelete"error C2065: 'in6addr_any' : undeclared identifier"