日期:2011-02-12  浏览次数:20436 次

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 hasnt been made. By and large, what

is available has been made possible by the porting of necessary utilities from Unix. Dont 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 dont 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 crlfs 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