Compile PHP5.4 and xdebug in Windows

Source: Internet
Author: User
This article describes how to compile PHP5.4 and xdebug in Windows. This article describes the compiling environment and related software packages, the compilation process, and how to handle possible errors during compilation, for more information, see. In fact, my ultimate goal is to compile php_xdebug.dll that supports PHP5.4. Before that, it is necessary to compile PHP5.4 successfully.

Compiling environment and related software packages:
1. Microsoft Visual C ++ 2008 Express Edition with SP1
2. Windows SDKs 6.1
3. php sdk Binary Tools
4. Dependable libs
5. PHP5.4 Sources
6. Xdebug 2.2.0-dev
If you need a VC6 compiling environment, you need to install Visual C ++ 6.0, and the SDK needs to be replaced:
Windows Server 2003 PSDK

Compilation process:

Preparing coffee and cola may take several hours...

Install VC ++ 2008 and Windows SDK 6.1

Create the following Directory:

The code is as follows:


D: \ php-sdk
D: \ php-sdk \ php54dev
D: \ php-sdk \ pecl


Decompress all files in the php-sdk-binary-tools-20110915.zip to D: \ php-sdk
Extract the deps directory from the deps-5.4-vc9-x86.7z to D: \ php-sdk \ php54dev
Decompress php5.4 source code to D: \ php-sdk \ php54dev, directory name, such as php-5.4.0RC3
Put the xdebug source code in D: \ php-sdk \ pecl \ xdebug

The final directory structure is like this:

The code is as follows:


D: \ php-sdk> tree D: \ php-sdk
Folder PATH listing for volume DISK_VOL2
Volume serial number is 0C74-AD73
D: \ PHP-SDK
── Bin
── Php54dev
│ ── Deps
│ ── Bin
│ ── Include
│ ── Lib
│ ── Sybase
│ ├ ── Pecl
│ ── Xdebug
│ └ ── Php-5.4.0RC3
── Script
── Share

Open Windows sdk cmd Shell and execute: setenv/x86/xp/release. if you are a 64-bit system, this command is required. do not change the parameter to/x64, otherwise, in the subsequent make stage, you will see thousands of logs...

Set PATH: set PATH = D: \ php-sdk \ bin; % PATH %

Switch the SHELL directory to D: \ php-sdk \ php54dev \ php-5.4.0RC3> and execute buildconf to generate the configure script:

The code is as follows:


D: \ php-sdk \ php54dev \ php-5.4.0RC3> buildconf
Rebuilding configure. js
Now run 'configure -- help'
D: \ php-sdk \ php54dev \ php-5.4.0RC3>


Run configure to generate the Make script. you can view configure-help to get more compilation options:

The code is as follows:


D: \ php-sdk \ php54dev \ php-5.4.0RC3> configure -- disable-snapshot-build -- disable-debug-pack -- disable-ipv6 -- disable-zts -- disable-isapi -- disable-nsapi -- without-t1lib -- -mssql -- without-pdo-mssql -- without-pi3web -- without-enchant -- enable-com-dotnet -- with-mcrypt = static -- disable-static-analyze -- with-xdebug = shared


Here I used-disable-snapshot-build to disable the snapshot mode, because this command will force many useless options for me, such as aolserver and apache sapi, finally, I added-with-xdebug = shared. before using this option, we 'd better confirm that the xdebug source code is in the correct position. if there is no problem, after buildconf, in configure-help, you can see this option. shared indicates compiling to a dynamic link library.

If you want to compile other pecl extensions (such as apc and bcompiler), you only need to download the relevant source code to the pecl directory and re-execute buildconf.

If configure is correct, run nmake to start the compilation process. Good Luck! :)

In the last step, nmake snap organizes the directory structure of all compiled files (that is, the structure of the PHP binary package that you download at ordinary times) and packs it with zip.

Location of the final generated File: D: \ php-sdk \ php54dev \ php-5.4.0RC3 \ Release (_ TS)

Error handling:
There will be a lot of warnings in the nmake process. as long as there is no interruption, it will be ignored.

About the encoding of calendar. c and jewish. c:

The code is as follows:


Ext \ calendar. c: warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
Dow. c
Easter. c
French. c
Gregor. c
Jewish. c
Ext \ calendar \ jewish. c: warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
Ext \ calendar \ jewish. c (324): error C2001: newline in constant
Ext \ calendar \ jewish. c (325): error C2001: newline in constant
Ext \ calendar \ jewish. c (326): error C2001: newline in constant
Ext \ calendar \ jewish. c (327): error C2001: newline in constant
NMAKE: fatal error U1077: '"C: \ Program Files (x86) \ Microsoft Visual Studio 9.0 \ VC \ Bin \ cl.exe"': return code '0x2'
Stop.


These two files are ANSI encoded and contain some special characters in Spanish. the GBK character set does not exist.
Open with editplus, code selection: West European (Windows), save as UTF-8.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.