Home Backend Development PHP Tutorial How to compile the source code of php and xdebug on windows

How to compile the source code of php and xdebug on windows

Aug 08, 2016 am 09:28 AM
apache nbsp php xdebug

There are many introductions to php source code compilation on the Internet, but there are almost no introductions to xdebug source code compilation. I will talk about it based on my actual operation, which will also involve the compilation of apache source code.

1. PHP compilation

We use vs2008 as the compilation tool; others also need PHP compilation kit, which can be downloaded from the PHP official website http://windows.php.net/downloads/php-sdk/, download this Bar:

php-sdk-binary-tools-20110915.zip

Assume it is released to the e:php-sdk directory

Enter command-line mode from the start menu:

Configure the vs2008 environment first. Enter the installation path of 2008 in naming mode, assuming it is c:program filesmicorosft visual studio v9.0; then enter the vc subdirectory under this directory again:

cd vc

c:program filesmicorosft visual studio v9.0vc This When executing vcvarsall.bat

c:program filesmicorosft visual studio v9.0vcvcvarsall.bat

this way the 2008 execution environment is established.

The next step is to enter the php-sdk directory,

e:php-sdk

Execute

binphpsdk_setvars.bat

Then execute:

binphpsdk_buildtree.bat phpdev

This will be created in the current directory There is a subdirectory phpdev. We put the downloaded php source code under its subdirectory vc9/x86. Taking 5.4.73 as an example, the directory will look like this:

e:php-sdkphpdevvc9/x86/ php-5.4.37

Enter the php-5.4.37 directory and execute

buildconf

The configure.bat and configure.js files will be generated

Execute again:

configure --disable-all --enable -cli

The makefile file will be generated at this time, and we can use this file to compile

Just execute nmake directly.

At this time, only the command line PHP executable file is generated. If you want to set up a web, you need a CGI PHP executable file. You can add --enable-cgi after configure, as follows:

configure --disable- all --enable-cli --enable-cgi

Sometimes when we need to generate a module that can be used by apache, we also need to add apache parameters (here, use apache 2.2 as an example):

configure --disable-all --enable-cli --enable-cgi --enable-apache2-2handler

But please note that you need apache's sdk (h file and lib file) at this time. The official has provided the corresponding sdk package for 2008, which is included in In the deps file, you can download the deps-5.4-vc9-x86 file from the official website.

After downloading, just release it in the deps directory.

Post-note: This method is also suitable for vc6 to compile version 5.3 of php, but at this time you need to install 2003sdk first, and when errors occur, you need to manually change the file (ext/standard/broscap.c file has several errors);

In addition, the official dependency package of vc6 is no longer provided. For example, compiling the apache module cannot pass. At this time, I have to compile apache and extract the sdk.

2. xdebug compilation

Preparation:

Requires 2003sdk or 6.1 sdk. Assuming that 2003sdk is installed, enter the compilation environment in xp through the menu, and then use the above method to add the vs2008 environment.

To compile xdebug, you need to use the php sdk. This can be generated from the source code of php. Just execute it again in the above environment:

nmake install

By default, the php directory will be generated in the c drive, as follows Contains an sdk subdirectory. In this directory, we will see a phpize.bat file.

Release the xdebug source code to the previous x86 directory, assuming it is version 2.2.7, so the directory will be xdebug-2.2.7

Enter this directory and execute phpize, usually with the full path:

c: phpsdkphpize

This will generate 3 documents: configure.bat,configure.js,confi.nice.bat

Execute again

configure --with-xdebug

Generate makefile

Finally execute

nmake

This is it php_xdebug.dll was generated in the

release_ts directory

Later note: The 2.2.7 version of xdebug can be compiled successfully under PHP 5.4.37, but cannot be compiled successfully under 5.3.x. In addition, xdebug of 2.1.x cannot be compiled normally under PHP 5.4.37.

3.apache compilation

vc6, 2003sdk can compile version 2.2.22 apache, but the prerequisite is to download:

apr-1.5.1-win32-src.zip, arp-iconv-1.2.1-win32- src-r2.zip, apr-util-1.5.4-win32-src.zip

Unzip them and put them into the source code srclib directory, replace them if there are any.

Enter xp, 32-bit environment through the 2003 sdk menu item;

Enter the source code directory, execute:

nmake /f makefile.win

Then execute:

nmake /f makefilw.win INSTDIR=c :apache

You will get an error at this time, the awk executable file is missing, but you find that there is already something in the c:apache directory

Copy the include path and lib path to the corresponding path of deps in php,

depsincludeapache2_2 (Including h file)

depslibapache2_2 (Including lib file)

Now execute:

configure --disable-all --enable-apache2_2handler

nmake

The apache module can be generated.

                                                              

The above introduces how to compile the source code of php and xdebug on Windows, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

PHP Program to Count Vowels in a String PHP Program to Count Vowels in a String Feb 07, 2025 pm 12:12 PM

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

7 PHP Functions I Regret I Didn't Know Before 7 PHP Functions I Regret I Didn't Know Before Nov 13, 2024 am 09:42 AM

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Top 10 PHP CMS Platforms For Developers in 2024 Top 10 PHP CMS Platforms For Developers in 2024 Dec 05, 2024 am 10:29 AM

CMS stands for Content Management System. It is a software application or platform that enables users to create, manage, and modify digital content without requiring advanced technical knowledge. CMS allows users to easily create and organize content

PHP and Social Media: Integrate Your Website with the World PHP and Social Media: Integrate Your Website with the World Oct 11, 2024 am 11:54 AM

PHP provides tools to allow websites to easily integrate social media functions: 1. Dynamically generate social media sharing buttons for users to share content; 2. Integrate with the OAuth library to achieve seamless social media login; 3. Use the HTTP library to capture social media Data, obtain user profile, posts and other information.

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

See all articles