Home > Article > Backend Development > Full records of compiling PHP5.4 and xdebug under Windows, php5.4xdebug_PHP tutorial
In fact, my ultimate goal is to compile php_xdebug.dll that supports PHP5.4, but before that , is necessary to successfully compile PHP5.4.
Compilation environment and related software packages:
1.Microsoft Visual C 2008 Express Edition with SP1
2.Windows SDK 6.1
3.PHP SDK Binary Tools
4.Dependable libs
5.PHP5.4 Sources
6.Xdebug 2.2.0-dev
If you need the VC6 compilation environment, then you need to install Visual C 6.0, and the SDK needs to be replaced with:
Windows Server 2003 PSDK
Compilation process:
Get your coffee and cola ready, it may take several hours...
Install VC 2008 and Windows SDK 6.1
Create the following directory:
Copy code The code is as follows:
D:php-sdk
D:php-sdkphp54dev
D:php-sdkpecl
Unzip all files in php-sdk-binary-tools-20110915.zip to D:php-sdk
Extract the deps directory in deps-5.4-vc9-x86.7z to D:php-sdkphp54dev
Unzip the php5.4 source code to D:php-sdkphp54dev, and choose any directory name, such as php-5.4.0RC3
The source code of xdebug is placed in D:php-sdkpeclxdebug
The final directory structure probably looks like this:
Copy code 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 the Windows SDK CMD Shell and execute: setenv /x86 /xp /release. If you are a 64-bit system, this command is necessary. Do not try to change the parameters to /x64, otherwise you will Saw thousands of WARNINGs…
Set PATH: set PATH=D:php-sdkbin;%PATH%
Switch the SHELL directory to D:php-sdkphp54devphp-5.4.0RC3> and execute buildconf to generate the configure script:
Copy code The code is as follows:
D:php-sdkphp54devphp-5.4.0RC3>buildconf
Rebuilding configure.js
Now run 'configure --help'
D:php-sdkphp54devphp-5.4.0RC3>
Execute configure to generate the Make script. You can view configure –help for more compilation options:
Copy code The code is as follows:
D:php-sdkphp54devphp-5.4.0RC3>configure --disable-snapshot-build --disable-debug-pack --disable-ipv6 --disable-zts --disable-isapi --disable-nsapi --without-t1lib --without-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 turn off the snapshot mode, because this command will force open many options that are useless to me, such as aolserver, apache sapi, etc. Finally, I added –with-xdebug= shared. Before using this option, it is best to confirm that the location of the xdebug source code is correct. If there is no problem, you can see this option in configure –help after buildconf. Shared means compiling into a dynamic link library.
If you want to compile other pecl extensions (such as apc, bcompiler, etc.), you only need to download the relevant source code and put it in the pecl directory and re-execute buildconf.
If there is no problem with configure, finally execute nmake to start the compilation process, Good Luck! :)
The last step is nmake snap, which organizes the directory structure of all compiled files (that is, the structure of the PHP binary package you usually download) and packages it with zip.
The final generated file location: D:php-sdkphp54devphp-5.4.0RC3Release(_TS)
Error handling:
A lot of Warnings will be generated during the nmake process. As long as they are not interrupted, just ignore them.
About the encoding issues of calendar.c and jewish.c:
Copy code The code is as follows:
extcalendarcalendar.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
extcalendarjewish.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
extcalendarjewish.c(324) : error C2001: newline in constant
extcalendarjewish.c(325) : error C2001: newline in constant
extcalendarjewish.c(326) : error C2001: newline in constant
extcalendarjewish.c(327) : error C2001: newline in constant
NMAKE: fatal error U1077: '"C:Program Files (x86)Microsoft Visual Studio 9.0VCBincl.exe"' : return code '0x2'
Stop.
These two files use ANSI encoding and contain some Western special characters that do not exist in the GBK character set.
It can be opened with editplus, encoding selection: West European (Windows), and saved as UTF-8.