Build your own PHP (php5.3+) on the windows platform_PHP tutorial

WBOY
Release: 2016-07-20 11:14:21
Original
837 people have browsed it

This is a translated article, the original text can be found at: https://wiki.php.net/internals/windows/stepbystepbuild

By the way, wiki.php.net has a lot of exciting content. Students who want to learn more about php should not miss it:)

Preparation

Compiling php on the windows platform requires three preparations:

1. A suitable compilation environment, including installing a compiler, the correct SDK and the corresponding binary tools

2. The third library and header files needed to compile PHP

3, PHP source code

Build environment

This is the most difficult part of compiling PHP on Windows platform, because setting up such a compilation environment requires a lot of disk space, which may be several G

Requirements:

  • Microsoft Visual C++, the official PHP version supports VC++6.0 and VC++9.0 (ie VC++2008), the Express version is also available. MinGW and other compilers are not supported.
  • The correct windows SDK or Platform SDK. The SDK needs to correspond to the VC version. For details, see https://wiki.php.net/internals/windows/windowssdk
  • Binary tools used during compilation, see http://windows.php.net/downloads/php-sdk/

Note:

The latest php5.5 can be compiled with VC++9 or VC++11, but 5.5 has not been officially released yet.

If you are using VC6, you need to install Windows Server Feb.2003 SDK. If you are using VC9, you need to install SDK6.1

Building steps

1, install vs2008

2, install windows sdk 6.1

3. Get the source code of php 5.3, you can get the snapshot from here (don’t unzip it first)

4, create the folder c:php-sdk

5. Unzip binary-tools.zip to the c:php-sdk folder. binary-tools.zip is available here (http://windows.php.net/downloads/php-sdk/). After decompression, C:php-sdk should contain subdirectories such as bin, script, share, etc.

6. Open windows sdk 6.1 shell and directly follow the following command:

PHP 5.2, 5.3 and 5.4:

setenv /x86 /xp /release

PHP 5.5+:

setenv /x86 /2008 /release

7,

cd c:php-sdk

8,

binphpsdk_setvars.bat

9,

binphpsdk_buildtree.bat php53dev

10. Now unzip the snapshot downloaded in step 3 to the C:php-sdkphp53devvc9x86 folder. After decompression is completed, the directory path will look like C:php-sdkphp53devvc9x86php5.3-xyz.

11. In C:php-sdkphp53devvc9x86, there is a deps folder. Download some libraries that compilation depends on and extract them into them. These libraries are available from http://wiki.php.net/internals/windows/libs. Make sure that after decompression is complete, the /include and /lib directories are included in deps. (Note: The author downloaded deps-5.3-vc9-x86.7z directly from http://windows.php.net/downloads/php-sdk/ and it can be compiled successfully)

12, continue to run in windows-sdk-shell

cd C:php-sdkphp53devvc9x86php5.3-xyz

13,

buildconf

14, view compilation options

configure --help

15, enter the build instructions according to your needs:

configure --disable-all --enable-cli compiles the simplest PHP kernel and only supports cli running mode

(Note: Some extensions require lib, header files and even other programs. For details, see libs. Download the version you need and extract it to the deps folder c:php-sdkphp53vc9x86deps)

16,

nmake

17, if you need to compress the compiled php file, continue to execute:

nmake snap

18. The compiled PHP is located in the C:php-sdkphp53devvc9x86php5.3-SNAPSHOTTIMERelease_TS directory.

Modify and recompile

1, clear the last compilation result

nmake clean

2, if you need to reconfigure

buildconf --force

3. Enter the new configure configuration

configure --disable-all --enable-cli --enable-$remains

4, compile

nmake

If you only compile the most streamlined PHP (only enable-cli), after the compilation is successful, you can observe which EXT and SAPI are compiled:

In addition to standard (standard extension), this php version only contains date, ereg, pcre, reflection, and SPL extensions. Their source codes can be found in php-src/ext.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/440292.htmlTechArticleThis is a translated article, the original text can be found at: https://wiki.php.net/internals/windows /stepbystepbuild By the way, wiki.php.net has a lot of exciting content. Students who want to learn more about php...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!