仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1934|回复: 19
打印 上一主题 下一主题

[学习教程] PHP网页编程之在 Windows 上面从源代码编译 PHP 的步...

[复制链接]
山那边是海 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-2-16 00:28:04 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
我假设你目前已经可以完成一个静态页面了,当然,做的好看难看是另外一说,皮皮我的第一个网页也没好看到哪去,但是“孩子”再丑,咱们做“爹妈”的也不能嫌弃不是?这毕竟是咱的成果。window|编译|源代码   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 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 cygwinbin, win32buildinclude,

and win32buildlib 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(库文件) 文件处,确认 cygwinbin,win32buildinclude,和win32buildlib 分离在每一个列内外面。(

要增添一个进口,先则列表尾部的空行,然后敲入).典范的了局以下:

c:cygnusbin

c:php-win32buildinclude

c:php-win32buildlib

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

win32buildlib directory over the file by the same name found in there.

这时候,你取得一个可用的 resolv.lib 在你的 Debug 或 Release 子目次上面。复制这个文件到你的 win32buildlib 目次,掩盖那边的同

名的文件。

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 sapiisapi) in order to build the code necessary for

integrating PHP with Microsoft IIS.

关于 phpisapi.dsp 反复下面的步调(在 sapiisapi 外面可以找到).创立 Microsoft IIS 的 isapi 法式.  看看西,人家这个编论坛,那个CMS,还有那啥CRM,我啥时候写一个呢?
山那边是海 该用户已被删除
沙发
 楼主| 发表于 2015-3-25 20:30:46 | 显示全部楼层
为了以后维护的方便最好是代码上都加上注释,“予人方便,自己方便”。此外开发文档什么的最好都弄齐全。我觉得这是程序员必备的素质。虽然会消耗点很多的时间。但是确实是非常有必要的。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-5-12 05:30

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表