仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1886|回复: 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-2-16 03:47:37 | 只看该作者
写js我最烦的就是 ie 和 firefox下同样的代码 结果显示的结果千差万别,还是就是最好不要用遨游去调试,因为有时候遨游是禁用js的,有可能代码是争取结果被遨游折腾的认为是代码写错。
兰色精灵 该用户已被删除
板凳
发表于 2015-3-4 23:30:03 | 只看该作者
环境搭建好,当你看见你的浏览器输出“it works\\\\\\\"时你一定是喜悦的。在你解决问题的时候,我强烈建议多读php手册。
活着的死人 该用户已被删除
地板
发表于 2015-3-13 07:08:18 | 只看该作者
学好程序语言,多些才是王道,写两个小时代码的作用绝对超过看一天书,这个我是深有体会(顺便还能练打字速度)。
飘飘悠悠 该用户已被删除
5#
发表于 2015-3-20 15:49:26 | 只看该作者
真正的方向了,如果将来要去开发团队,你一定要学好smarty ,phplib这样的模板引擎,
飘灵儿 该用户已被删除
6#
发表于 2015-3-20 20:05:51 | 只看该作者
使用 jquery 等js框架的时候,要随时注意浏览器的更新情况,不然很容易发生框架不能使用。
山那边是海 该用户已被删除
7#
 楼主| 发表于 2015-3-25 20:30:46 | 只看该作者
为了以后维护的方便最好是代码上都加上注释,“予人方便,自己方便”。此外开发文档什么的最好都弄齐全。我觉得这是程序员必备的素质。虽然会消耗点很多的时间。但是确实是非常有必要的。
再现理想 该用户已被删除
8#
发表于 2015-3-27 19:10:56 | 只看该作者
Apache不是非得用80或者8080端口的,我刚开始安得时候就是80端口老占用,就用了个 81端口,结果照常,就是输localhost的时候,应该输入为 localhost:81
灵魂腐蚀 该用户已被删除
9#
发表于 2015-4-2 11:53:08 | 只看该作者
基础有没有对学习php没有太大区别,关键是兴趣。
柔情似水 该用户已被删除
10#
发表于 2015-4-5 15:10:30 | 只看该作者
因为blog这样的可以让你接触更多要学的知识,可以接触用到类,模板,js ,ajax
若天明 该用户已被删除
11#
发表于 2015-4-22 16:51:13 | 只看该作者
php是动态网站开发的优秀语言,在学习的时候万万不能冒进。在系统的学习前,我认为不应该只是追求实现某种效果,因为即使你复制他人的代码调试成功,实现了你所期望的效果,你也不了解其中的原理。
12#
发表于 2015-4-27 07:20:33 | 只看该作者
使用 jquery 等js框架的时候,要随时注意浏览器的更新情况,不然很容易发生框架不能使用。
再见西城 该用户已被删除
13#
发表于 2015-4-28 02:28:58 | 只看该作者
首先声明:我是一个菜鸟,是一个初学者。学习了一段php后总是感觉自己没有提高,无奈。经过反思我认为我学习过程中存在很多问题,我改变了学习方法后自我感觉有了明显的进步。
海妖 该用户已被删除
14#
发表于 2015-5-3 02:10:36 | 只看该作者
真正的方向了,如果将来要去开发团队,你一定要学好smarty ,phplib这样的模板引擎,
因胸联盟 该用户已被删除
15#
发表于 2015-5-3 21:56:36 | 只看该作者
曾经犯过一个很低级的错误,我在文件命名的时候用了一个横线\\\\\\\'-\\\\\\\' 号,结果找了好几个小时的错误,事实是命名的时候 是不能用横线 \\\\\\\'-\\\\\\\' 的,应该用的是下划线  \\\\\\\'_\\\\\\\' ;
第二个灵魂 该用户已被删除
16#
发表于 2015-5-6 18:09:32 | 只看该作者
刚开始安装php的时候,我图了个省事,把php的扩展全都打开啦(就是把php.ini 那一片 extension 前面的冒号全去掉啦),这样自然有好处,以后不用再需要什么功能再来打开。
老尸 该用户已被删除
17#
发表于 2015-6-11 02:29:51 | 只看该作者
实践是检验自己会不会的真理。
金色的骷髅 该用户已被删除
18#
发表于 2015-7-5 00:40:09 | 只看该作者
这些中手常用的知识,当你把我说的这些关键字都可以熟练运用的时候,你可以选择自己
小女巫 该用户已被删除
19#
发表于 2015-7-11 22:06:09 | 只看该作者
开发工具也会慢慢的更专业,每个公司的可能不一样,但是zend studio是个大伙都会用的。
冷月葬花魂 该用户已被删除
20#
发表于 2015-7-13 05:14:25 | 只看该作者
如果你已经到这种程度了,那么你已经可以做我的老师了。其实php也分很多的区域,
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-4-28 13:53

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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