首頁 php教程 php手册 在 Windows 下面从源代码编译 PHP 的步骤

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

Jun 21, 2016 am 09:08 AM
and build php select the

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 程序.



本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

<🎜>:泡泡膠模擬器無窮大 - 如何獲取和使用皇家鑰匙
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
北端:融合系統,解釋
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
Mandragora:巫婆樹的耳語 - 如何解鎖抓鉤
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

熱門話題

Java教學
1666
14
CakePHP 教程
1425
52
Laravel 教程
1325
25
PHP教程
1273
29
C# 教程
1252
24
PHP和Python:比較兩種流行的編程語言 PHP和Python:比較兩種流行的編程語言 Apr 14, 2025 am 12:13 AM

PHP和Python各有優勢,選擇依據項目需求。 1.PHP適合web開發,尤其快速開發和維護網站。 2.Python適用於數據科學、機器學習和人工智能,語法簡潔,適合初學者。

PHP:網絡開發的關鍵語言 PHP:網絡開發的關鍵語言 Apr 13, 2025 am 12:08 AM

PHP是一種廣泛應用於服務器端的腳本語言,特別適合web開發。 1.PHP可以嵌入HTML,處理HTTP請求和響應,支持多種數據庫。 2.PHP用於生成動態網頁內容,處理表單數據,訪問數據庫等,具有強大的社區支持和開源資源。 3.PHP是解釋型語言,執行過程包括詞法分析、語法分析、編譯和執行。 4.PHP可以與MySQL結合用於用戶註冊系統等高級應用。 5.調試PHP時,可使用error_reporting()和var_dump()等函數。 6.優化PHP代碼可通過緩存機制、優化數據庫查詢和使用內置函數。 7

PHP行動:現實世界中的示例和應用程序 PHP行動:現實世界中的示例和應用程序 Apr 14, 2025 am 12:19 AM

PHP在電子商務、內容管理系統和API開發中廣泛應用。 1)電子商務:用於購物車功能和支付處理。 2)內容管理系統:用於動態內容生成和用戶管理。 3)API開發:用於RESTfulAPI開發和API安全性。通過性能優化和最佳實踐,PHP應用的效率和可維護性得以提升。

PHP與Python:了解差異 PHP與Python:了解差異 Apr 11, 2025 am 12:15 AM

PHP和Python各有優勢,選擇應基於項目需求。 1.PHP適合web開發,語法簡單,執行效率高。 2.Python適用於數據科學和機器學習,語法簡潔,庫豐富。

PHP的持久相關性:它還活著嗎? PHP的持久相關性:它還活著嗎? Apr 14, 2025 am 12:12 AM

PHP仍然具有活力,其在現代編程領域中依然佔據重要地位。 1)PHP的簡單易學和強大社區支持使其在Web開發中廣泛應用;2)其靈活性和穩定性使其在處理Web表單、數據庫操作和文件處理等方面表現出色;3)PHP不斷進化和優化,適用於初學者和經驗豐富的開發者。

PHP和Python:代碼示例和比較 PHP和Python:代碼示例和比較 Apr 15, 2025 am 12:07 AM

PHP和Python各有優劣,選擇取決於項目需求和個人偏好。 1.PHP適合快速開發和維護大型Web應用。 2.Python在數據科學和機器學習領域佔據主導地位。

PHP與其他語言:比較 PHP與其他語言:比較 Apr 13, 2025 am 12:19 AM

PHP適合web開發,特別是在快速開發和處理動態內容方面表現出色,但不擅長數據科學和企業級應用。與Python相比,PHP在web開發中更具優勢,但在數據科學領域不如Python;與Java相比,PHP在企業級應用中表現較差,但在web開發中更靈活;與JavaScript相比,PHP在後端開發中更簡潔,但在前端開發中不如JavaScript。

PHP和Python:解釋了不同的範例 PHP和Python:解釋了不同的範例 Apr 18, 2025 am 12:26 AM

PHP主要是過程式編程,但也支持面向對象編程(OOP);Python支持多種範式,包括OOP、函數式和過程式編程。 PHP適合web開發,Python適用於多種應用,如數據分析和機器學習。

See all articles