如何在windows上编译PHP,在Windows下面从源代码编译PHP的步骤

在Windows下面从源代码编译PHP的步骤

作者   紫竹  来源   www.php.net

Building from source

从源代码建立

Before getting started, it is worthwhile answering the question: "Why is building on Windows so hard?" Two reasons come to

mind:

在开始前,我们来回答一个问题:“为什么在 Windows 下编译 php 如此困难?“,2个注意的原因是:

Windows does not (yet) enjoy a large community of developers who are willing to freely share their source. As a direct

result, the necessary investment in infrastructure required to support such development hasn't been made. By and large, what

is available has been made possible by the porting of necessary utilities from Unix. Don't be surprised if some of this

heritage shows through from time to time.

Windows 不是一个大量愿意免费共享他们代码的开发团体。直接导致支持这些开发的基础投资没有建立,而Unix 可能已经建立了。

Pretty much all of the instructions that follow are of the "set and forget" variety. So sit back and try follow the

instructions below as faithfully as you can.

下面的大多数好东西是"set and forget".所以请尽可能严格按照下面的步骤进行。

Preparations

Before you get started, you have a lot to download....

准备:

在开始前,你需要下载许多东西!!

For starters, get the Cygwin toolkit from the closest Cygnus mirror site. What you are looking for is cygwin.exe file. This

will provide you most of the popular GNU utilities used by the build process.

http://sources.redhat.com/cygwin/download.html

开始,从最近的 Cygnus 的镜像站点获取 Cygwin 工具箱。你要找的是 cygwin.exe 文件。他提供了大多数流行的 GNU 工具用于编译过程:

Download the rest of the build tools you will need from the PHP site at http://www.php.net/extra/win32build.zip.

下载其他的编译需要的工具,从 php 的站点:

Get the source code for the DNS name resolver used by PHP at http://www.php.net/extra/bindlib_w32.zip. This is a replacement

for the resolv.lib library included in win32build.zip.

获得 PHP 使用的用于 DNS 名字解析的源代码。替换 win32build.zip 里面的 resolv.lib 文件

If you don't already have an unzip utility, you will need one. A free version is available from InfoZip.

如果你没有解压缩工具,你需要下载一个。 InfoZip 有一个免费的!!

Finally, you are going to need the source to PHP 4 itself. You can get the latest development version using anonymous CVS. If

you get a snapshot or a source tarball, you not only will have to untar and ungzip it, but you will have to convert the bare

linefeeds to crlf's in the *.dsp and *.dsw files before Microsoft Visual C++ will have anything to do with them.

最后,你需要 PHP 的源代码本身。你可以使用匿名 CVS 获得最新的开发版本。如果你得到的是一个 snapshot 或者一个源代码 tarball, 你

不仅需要展开它, 而且在 Microsoft Visual C++ 可以处理所有东西前,你需要转换在 *.dsp 和 *.dws 文件里的空的换行符为回车换行符号

Note: Place the Zend and TSRM directories inside the php4 directory in order for the projects to be found during the build

process.

注意:放置 Zend 和 TSTM 目录在 php4 目录里面,使得工程在建立期间可以找到他们

Putting it all together

把他们放在一起

Follow the instructions for installing the unzip utility of your choosing.

按照下面的步骤来安装你选择的展开系统

Execute cygwin.exe and follow the installation instructions. If you choose to install to a path other than c:\cygnus, let the

build process know by setting the Cygwin environment variable. On Windows 95/98 setting an environment variable can be done

by placing a line in your autoexec.bat. On Windows NT, go to My Computer => Control Panel => System and select the

environment tab.

运行 cygwin.exe,按照安装步骤进行。如果你选择安装到一个不是 C:\cygnus 的路径,必须通过设置 cygwin 环境变量通知建立程序。在

Windows 95/98 下,设置环境变量可以通过在 Autoexec.bat 里加入一行来做到!在 Window NT,打开 我的电脑 => 系统 然后选择化镜变量标

签。

Warning

Make a temporary directory for Cygwin to use, otherwise many commands (particularly bison) will fail. On Windows 95/98, mkdir

C:\TMP. For Windows NT, mkdir %SystemDrive%\tmp.

警告:

建立一个 Cygwin使用的临时目录。否则许多命令(特别是 bison)会失败。在 Windows 95/98 下,建立目录 mkdir c:\tmp, 在 Windows NT

下 mkdir %SystemDrive%\tmp。

Make a directory and unzip win32build.zip into it.

建立一个目录,展开 win32build.zip 到里面

Launch Microsoft Visual C++, and from the menu select Tools => Options. In the dialog, select the directories tab.

Sequentially change the dropdown to Executables, Includes, and Library files, and ensure that cygwin\bin, win32build\include,

and win32build\lib are in each list, respectively. (To add an entry, select a blank line at the end of the list and begin

typing). Typical entries will look like this:

运行 Microsoft Visual C++,从菜单里选择 Tools => Option. 在对话框里,选择 Directories(路径) 标签.向下移动到 Executables(可执

行), Includes(包含文件), 和 Library(库文件) 文件处,确认 cygwin\bin,win32build\include,和win32build\lib 分别在每个列表里面。(

要增加一个入口,先则列表尾部的空行,然后敲入).典型的结果如下:

c:\cygnus\bin

c:\php-win32build\include

c:\php-win32build\lib

Press OK, and exit out of Visual C++.

按 OK 键。退出 Visual C++

Make another directory and unzip bindlib_w32.zip into it. Decide whether you want to have debug symbols available (bindlib -

Win32 Debug) or not (bindlib - Win32 Release). Build the appropriate configuration:

建立另外一个目录,展开 blindlib_w32.zip 到里面。确定是否你想要调试符号。建立恰当的配置。

For GUI users, launch VC++, and then select File => Open Workspace and select bindlib. Then select Build=>Set Active

Configuration and select the desired configuration. Finally select Build=>Rebuild All.

对于 GUI 用户,运行 VC++, 选择 File => open Workspace, 然后选择 bindlib. 然后选择 Build=>Set Active Configuration ,选择想要的

配置。最后选择 Build => Rebuild All.

For command line users, make sure that you either have the C++ environment variables registered, or have run vcvars.bat, and

then execute one of the following:

对于命令行用户,确认你已经注册 C++环境变量或者已经运行了 vcvars.bat.然后运行下面的任何一个

msdev bindlib.dsp /MAKE "bindlib - Win32 Debug"

msdev bindlib.dsp /MAKE "bindlib - Win32 Release"

At this point, you should have a usable resolv.lib in either your Debug or Release subdirectories. Copy this file into your

win32build\lib directory over the file by the same name found in there.

这时,你获得一个可用的 resolv.lib 在你的 Debug 或者 Release 子目录下面。复制这个文件到你的 win32build\lib 目录,覆盖那里的同

名的文件。

Compiling

编译

The best way to get started is to build the standalone/CGI version.

开始最好建立独立/CGI版本

For GUI users, launch VC++, and then select File => Open Workspace and select php4ts. Then select Build=>Set Active

Configuration and select the desired configuration. Finally select Build=>Rebuild All.

对于 GUI 用户,运行 VC++,选择 File => Open Workspace 选择 php4ts,然后选择 Build => Set Active Configuration, 选择想要的配置。

最后选择 Build => Rebuild All.

For command line users, make sure that you either have the C++ environment variables registered, or have run vcvars.bat, and

then execute one of the following:

对于命令行用户,确认你已经注册 C++环境变量或者已经运行了 vcvars.bat.然后运行下面的任何一个

msdev php4ts.dsp /MAKE "php4ts - Win32 Debug_TS"

msdev php4ts.dsp /MAKE "php4ts - Win32 Release_TS"

At this point, you should have a usable php.exe in either your Debug_TS or Release_TS subdirectories.

这时,你可以得到可用的 php.exe 在你的 Debug_TS 或者 Release_TS 子目录下面。

Repeat the above steps with php4isapi.dsp (which can be found in sapi\isapi) in order to build the code necessary for

integrating PHP with Microsoft IIS.

对于 phpisapi.dsp 重复上面的步骤(在 sapi\isapi 里面可以找到).建立 Microsoft IIS 的 isapi 程序。

----

- PHP世纪网 -

http://www.php2000.com

http://www.php2000.net

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
大学生参加学科竞赛有着诸多好处,不仅有助于个人综合素质的提升,还能为未来职业发展奠定良好基础。以下是一些分析: 首先,学科竞赛是提高专业知识和技能水平的有效途径。通过参与竞赛,学生不仅能够深入学习相关专业知识,还能够接触到最新的科研成果和技术发展趋势。这有助于拓展学生的学科视野,使其对专业领域有更深刻的理解。在竞赛过程中,学生通常需要解决实际问题,这锻炼了他们独立思考和解决问题的能力。 其次,学科竞赛培养了学生的团队合作精神。许多竞赛项目需要团队协作来完成,这促使学生学会有效地与他人合作、协调分工。在团队合作中,学生们能够学到如何有效沟通、共同制定目标和分工合作,这对于日后进入职场具有重要意义。 此外,学科竞赛是提高学生综合能力的一种途径。竞赛项目通常会涉及到理论知识、实际操作和创新思维等多个方面,要求参赛者具备全面的素质。在竞赛过程中,学生不仅需要展现自己的专业知识,还需要具备创新意识和解决问题的能力。这种全面的综合能力培养对于未来从事各类职业都具有积极作用。 此外,学科竞赛可以为学生提供展示自我、树立信心的机会。通过比赛的舞台,学生有机会展现自己在专业领域的优势,得到他人的认可和赞誉。这对于培养学生的自信心和自我价值感非常重要,有助于他们更加积极主动地投入学习和未来的职业生涯。 最后,学科竞赛对于个人职业发展具有积极的助推作用。在竞赛中脱颖而出的学生通常能够引起企业、研究机构等用人单位的关注。获得竞赛奖项不仅可以作为个人履历的亮点,还可以为进入理想的工作岗位提供有力的支持。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值