当前位置: 首页 > 图文教程 > 服务器 > Windows服务器 > 纯手工配置 IIS 6 下 FastCGI 的 PHP

Windows服务器
配置 Windows Server 2003-IIS 6
Windows 2003系统也玩图片收藏屏保
远程如何修改Windows 2003机器名
在Windows 2003中重置TCP/IP
查看Windows 2003系统日志的简单办法
根治Windows 2003操作系统登录及关机麻烦
为Windows 2003安全—层层设防
保障Windows Server 2003域控制器的安全性
自己动手抠出2003中的IIS6安装程序
Windows 2003操作系统十例最新配置技巧
架设维护Windows Server 2003网页服务器
轻松配置windows2003自带mail服务器
Windows 2003系统中如何实现网络共享还原
Windows Server 2003全接触(1)
Windows Server 2003全接触(2)
Windows Server 2003全接触(3)
Win Server2003常见问题及解决然方案
Windows Server 2003 防火墙
备份与恢复Win2003的AD数据库
Windows Server 2003的Web接口

Windows服务器 中的 纯手工配置 IIS 6 下 FastCGI 的 PHP


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-04   浏览: 208 ::
收藏到网摘: n/a

下午在公司已经可以在 Windows Server 2008 和 IIS 7 下跑 PHP 了,家里是 Windows Server 2003 和 IIS 6 的,虽然之前也可以跑过 PHP,但觉得过程糊里糊涂,不知所以然,google 一翻,终于实现手工配置 IIS 6 下以 FastCGI 跑 PHP。

回头把 IIS 7 下的实现方法也帖上。

环境:
操作系统:Windows 2003 Server SP2
PHP 版本:php-5.2.6-Win32

1.下载 FastCGI For IIS6

http://www.microsoft.com/downloads/details.aspx?FamilyID=2d481579-9a7c-4632-b6e6-dee9097f9dc5&displaylang=en

下载之后,双击运行进行安装。

安装后在 C:\WINDOWS\system32\inetsrv 目录下产生了五个文件。如下图:

iis6fcgi_1.jpg

大小: 16.5 K
尺寸: 500 x 76
浏览: 7 次
点击打开新窗口浏览全图

同时在 IIS 的 “Web 服务扩展”里多了 FastCGI Handler。

iis6fcgi_2.jpg

大小: 40.6 K
尺寸: 500 x 311
浏览: 6 次
点击打开新窗口浏览全图

2.下载 PHP5.25 Windows 版
http://www.php.net/downloads.php

下载 .zip 格式的版本,下载后解压至 D:\PHP 目录,并给 IIS 启动帐户组或用户赋予读取和运行权限。如下图:

iis6fcgi_3.jpg

大小: 24.58 K
尺寸: 358 x 328
浏览: 8 次
点击打开新窗口浏览全图

你可以根据自己的意愿解压到别的目录。

3. 注册 PHP 到 FastCGI

打开 C:\WINDOWS\system32\inetsrv\fcgiext.ini 文件。

; This is the configuration file for the FastCGI handler for IIS 6.0.
; The FastCGI handler will look for this file in the same directory as
; fcgiext.dll. By default, the FastCGI installer will place this file into
; the %windir%\system32\inetsrv directory.

我个人的理解是,只要“Web 服务扩展”里的 FastCGI Handler 为允许时,在加载 fcgiext.dll 时,会读取 fcgiext.ini 配置文件的内容,根据里面的配置为每个网站提供映射。

在 [Types] 下添加以下配置:

[Types]
php=PHP

[PHP]
ExePath=D:\PHP\php-cgi.exe

“php”表示扩展名,“PHP”是配置节名称,以“[PHP]”定义。

4. 配置 php.ini

将 D:\PHP\php.ini-recommended 复制一个,然后重命名为 D:\PHP\php.ini

打开 D:\PHP\php.ini,修改:

extension_dir = "D:\PHP\ext"
fastcgi.impersonate = 1

其它的根据实际需要对 php.ini 进行设置修改,这里只针对能跑 php,修改完记得重启 IIS。

5. 配置网站

右键网站 => 属性 => 主目录 => 配置 => 添加,如下图配置:

iis6fcgi_4.jpg

大小: 20.07 K
尺寸: 445 x 252
浏览: 8 次
点击打开新窗口浏览全图

可执行文件路径:C:\WINDOWS\system32\inetsrv\fcgiext.dll

6. 写个 php 测试下吧

<?php
phpinfo();
?>

看到类似以下效果说明你的服务器可以跑 php 了。

iis6fcgi_4.jpg

大小: 20.07 K
尺寸: 445 x 252
浏览: 8 次
点击打开新窗口浏览全图

打开后如果出现提示:

No input file specified.

估计是没配置 fastcgi.impersonate。

如果你还觉得麻烦,那就到 http://www.zend.com 下载 Zend Core,这个就什么都不用配置,安装完就可以使用了,连 MySQL 都有。