windows 上 怎样编译 php 和 xdebug的 源代码
网上有很多的php源代码编译介绍,但是几乎没有xdebug 的源码编译的介绍,我这里结合自己的实际操作来谈一下,其中也会涉及到apache源代码的编译。
1. php编译
我们以vs2008来作为编译工具;其他还需要php的编译套件,这个可在php官方网下载http://windows.php.net/downloads/php-sdk/,下载这个吧:
php-sdk-binary-tools-20110915.zip
假设把它释放到e:\php-sdk目录下
从开始菜单进入command-line模式:
先把vs2008的环境配置好,在命名模式下进入2008的安转路径,假设在c:\program files\micorosft visual studio v9.0; 则再次进入该目录下的vc子目录:
cd vc
c:\program files\micorosft visual studio v9.0\vc 此时执行vcvarsall.bat
c:\program files\micorosft visual studio v9.0\vc\vcvarsall.bat
这样2008的执行环境就建立好了。
下一步就是进入到php-sdk目录下,
e:\php-sdk
执行
bin\phpsdk_setvars.bat
接下来执行:
bin\phpsdk_buildtree.bat phpdev
这下就会在当前目录创建一子目录phpdev,我们把下载回来的php源代码放入到其子目录vc9/x86下面,以5.4.73为例子,这样就会目录就会是这样:
e:\php-sdk\phpdev\vc9/x86/php-5.4.37
进入到php-5.4.37目录,执行
buildconf
这时会产生configure.bat和configure.js 文件
再次执行:
configure --disable-all --enable-cli
这时候就会产生makefile 文件,我们就可以用这个文件进行编译
直接执行nmake就可以了。
这时候只产生命令行的php执行档,如果想要架设web,那就需要一个cgi的php执行档,可在configure 后面加上 --enable-cgi,如下:
configure --disable-all --enable-cli --enable-cgi
有时候我们要需要产生apache能用的module ,就还要加上apache的参数(这里以apache 2.2为例子):
configure --disable-all --enable-cli --enable-cgi --enable-apache2-2handler
但请注意,这时候需要apache 的sdk(h文件和lib文件),官方已提供了2008的对应sdk包,它包含在deps文件里面,可在官方下载deps-5.4-vc9-x86文件。
下载后把它释放在deps目录下就可以了。
后注:这个方法也适合vc6来编译5.3版的php,只是这时候要先安装2003sdk, 出错时要手动去更改一下文件(ext/standard/broscap.c文件有几处错误);
另外官方不再提供vc6的依赖包,比如编译apache 的module就过不了,这时只有自己在去编译apache,把sdk提取出来。
2. xdebug 编译
前期准备:
需要2003sdk或 6.1 sdk,假设安装的2003sdk,现通过菜单进入在xp的编译环境,再用上面的方法把vs2008环境加进来。
要编译xdebug,需要用到php的sdk, 这个可以从php 的源代码中产生,只要在上面的环境中再次执行:
nmake install
默认情况下会在c盘产生php目录,下面包含一个sdk子目录,在这个目录中,我们将看到有一个phpize.bat文件。
把xdebug源代码释放到前面的x86目录下,假设为2.2.7版,这样目录就为xdebug-2.2.7
进入到这个目录,执行phpize,一般带全路径执行:
c:\php\sdk\phpize
这样会产生3个文档:configure.bat,configure.js,confi.nice.bat
再次执行
configure --with-xdebug
产生makefile
最后执行
nmake
这样就在
release_ts目录下产生了php_xdebug.dll
后注:2.2.7版的xdebug之能在php 5.4.37下编译成功,但不能在5.3.x 下编译成功。另外2.1.x的xdebug也不能在php 5.4.37 下正常编译。
3.apache 编译
vc6,2003sdk 可以编译2.2.22版apache,但前提条件是要下载:
apr-1.5.1-win32-src.zip,arp-iconv-1.2.1-win32-src-r2.zip,apr-util-1.5.4-win32-src.zip
解压它们并把它们放入源代码srclib目录下,如果有的就替换掉。
通过2003 sdk 的菜单项进入到xp,32位环境;
进入到源代码目录,执行 :
nmake /f makefile.win
而后执行 :
nmake /f makefilw.win INSTDIR=c:\apache
这时会抱错,缺少awk执行文件,但是你发现c:\apache目录下已经有东西了
把里面的include 路径和lib路径拷贝到php 的deps 相对应路径下,
deps\include\apache2_2 (包含h文件)
deps\lib\apache2_2 (包含lib文件)
这时执行:
configure --disable-all --enable-apache2_2handler
nmake
就可以产生apache 的module了。

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.

In PHP, use the clone keyword to create a copy of the object and customize the cloning behavior through the \_\_clone magic method. 1. Use the clone keyword to make a shallow copy, cloning the object's properties but not the object's properties. 2. The \_\_clone method can deeply copy nested objects to avoid shallow copying problems. 3. Pay attention to avoid circular references and performance problems in cloning, and optimize cloning operations to improve efficiency.

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Dreamweaver CS6
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Notepad++7.3.1
Easy-to-use and free code editor