Requirements: |
|
Directory Structure: |
+--C:\phpx64 | | | +--php_build (From Development Kit) | | | | | +--apache2 | | | | | +--... | | | | | +--include | | | | | +--lib | | | +--php-5.x.x (PHP Source Code) | | | | | +--build | | | | | +--... | | | | | +--win32 | | | | | +--... | | | +--template (From Development Kit) | | | | | +--dlls | | | | | +--mibs | | | | | +--... |
Replacing Headers: (Optional)** |
Several headers (*.h) need replacing inside VC. The new headers are located in modified-headers.zip (inside Development Kit) !-- BACKUP YOUR EXISTING HEADERS --! +--C:\Program Files (x86)\Microsoft Visual Studio 8\VC (Change to your VC directory) | | | +--include | | | | | +--sys | | | | | | | +--stat.h | | | | | | | +--types.h | | | | | | | +--utime.h | | | | | +--crtdefs.h | | | | | +--time.h ** Optional: Try to compile PHP x64 first before replacing with these headers. While fixing PHP they can break other projects so use with caution. Headers are modified versions from Microsoft Visual Studio 2005 (8.0). |
Setting up the Environment: |
In order to compile for x64 your
environmental settings need to be correct. VC has a shortcut installed for you in the Start Menu. Start > Programs > Microsoft Visual Studio 2005 > Visual Studio Tools > Visual Studio 2005 x64 Win64 Command Prompt A command prompt will open with PATH and other variables will be correctly set to compile 64-bit applications. Navigate to the PHP source directory (cd C:\phpx64\php-5.x.x) |
Building and Running the Configuration Script: |
It's time to configure PHP to be built. Now run "buildconf" in the Visual Studio x64 Win64 Command Prompt window. You should now have a configure.js file inside \php-5.x.x. To configure PHP to build a "snapshot" (attempt to build everything possible) run this command: cscript /nologo configure.js "--enable-snapshot-build" Paying close attention to the configuration script output can save you a lot of headaches in the end. You can scroll up through the command prompt to make sure it finds the important EXEs (cl, link, bison, flex, etc) and note any errors. An alternative method is to capture the configuration output to a file for future inspection if something goes wrong (not required): cscript /nologo configure.js "--enable-snapshot-build" >> C:\config.txt |
Copy a DLL: |
Building PHP with Microsoft VC++ you will create binaries that are dependant on a DLL (msvcr?0.dll,
?= VC++ Version). If you are using Microsoft Visual C++ 8.0 (2005), msvcr80.dll is placed correctly already. If using a different
version, you must find msvcr?0.dll and place it in "C:\phpx64\template\dlls"! |
Building!: |
PHP should now tell you to enter the command "nmake snap" to build PHP. It's time. Type
in the command as told and let it work. It may take up to 10 minutes to complete the build processes. The binaries will be placed in
C:\phpx64\php-5.x.x\Release_TS\php-5.x.x. To capture the build output for debugging (not required but very helpful!): nmake snap >> C:\build.txt |
Build IIS API Module (Optional): |
Download PHP x64 ISAPI Module (ZIP, 14.4 KB) and follow the read me at THIS STEP! |
Manually Building Missing Extensions (Optional): |
Check the compiled extensions to see if any ones you require are missing. If they are, hopefully you captured the configuration output and output of the build, check the logs!
Most likely it will be simple error like a file can not be found. You'll have to open the VC project inside the \php-x.x.x\ext\yyyy directory. Make sure you're building x64 and
give it a shot. Read the error log, fix the error, and keep trying. |
You're DONE! (as long as it worked!) |
Your binaries are located in C:\phpx64\php-5.x.x\Release_TS\php-5.x.x. |
Debugging: |
If you run into problems you're going to have to find out what's wrong.
Most likely it will that a file can not be located. Using the capture to file method will allow
you to review what went wrong throughout the whole build process. To try building again you do not
have to re-run the configuration script (as long as the configuration script found the required EXEs).
Run "nmake clean" to clean the build and "nmake snap" to build. |