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

2.下载 PHP5.3 R3 安装版
 

3. 注册 PHP 到 FastCGI【如果是选择5.3 R3安装版则可以省略此步骤,因为它自动添加了配置

打开 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-production 复制一个,然后重命名为 D:\PHP\php.ini

打开 D:\PHP\php.ini,
修改PHP.ini文件:
1。第531行改为:display_errors = On
2。第542行改为:display_startup_errors = On
3。第624行改为:error_prepend_string = "<br><font color=#ff0000>"
4。第630行改为:error_append_string = "</font><br><br>"
5。第813行改为:extension_dir = "D:\php\php_setup_files\php-5.3-vc9\ext\"
6。第854行改为:fastcgi.impersonate = 1
7。从948行到988行根据自己的需要修改
8。第997行改为:date.timezone = asia/Shanghai

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

5. 配置网站【此步骤也可以省略,因为安装版自动添加了!

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

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

6. 写个 php 测试下吧

<?php
phpinfo();
?>

PHP目录权限:IWAM_机器名称(和上图中并没有影响,感觉它的权限更小些,但两种权限都能正常运行)

错误信息:
1。Error Number: 14001 (0x800736b1).
   没有安装Microsoft Visual C++ 2008 Redistributable Package


2。Error Number: 5 (0x80070005).
   Unable to place a FastCGI process in a JobObject. Try disable the Application Pool CPU Limit feature
   取消CPU的监视

3。No input file specified.

估计是没配置 fastcgi.impersonate。

第二部分:apache2.2.11 + php5.3
   1。下载apache2.2.11     下载网址:www.apache.org
   2。下载php5.3    下载网站:http://windows.php.net/download/  (在此选择VC6 x86 Thread Safe版本)
   3。解压php5.3到任意目录,找到PHP安装目录下的php.ini-development并改名为php.ini文件,开始配置:
        ; date.timezone =             改为   date.timezone = Asia/Shanghai
        ; extension_dir = "ext"      改为   extension_dir = "./ext/" 
        ;error_reporting = E_ALL & ~E_DEPRECATED   去掉;
        ;display_errors = On                                            去掉;
        ;display_startup_errors = On                               去掉;
        ;error_prepend_string =                                       改为:"<font style='font-size:16px;color:#ff0000'>"
        ;error_append_string =                                        改为:"</font><br><br><br>"
        ;default_mimetype = "text/html"                            去掉;
       至于php.ini里面的extension开启方式,根据自己所需求开启所需功能。
    4。配置httpd.conf也就是apache的配置文件
       添加:
         LoadModule php5_module "D:/php/php-5.3.0/php5apache2_2.dll"
         PHPIniDir "D:/php/php-5.3.0"
         下面的模块,根据自己的需求开启。
         创建虚拟目录:
<VirtualHost 127.0.0.22:80>
    DocumentRoot D:/php/Apache2.2/htdocs1
    ServerName 127.0.0.22:80
    <Directory "D:/php/Apache2.2/htdocs1">
       Options Indexes FollowSymLinks
       DirectoryIndex index.html index.htm index.php
       AllowOverride All
       Order allow,deny
       Allow from all
    </Directory>
    ErrorLog  D:/php/Apache2.2/htdocs1/error.log
    LogLevel warn
    LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost
    CustomLog D:/php/Apache2.2/htdocs1/access.log vhost
</VirtualHost>
    OK了,运行一下看看效果吧。

 

“PHP5.3是不能在IIS6上面通过ISAPI扩展运行的,而且在PHP5.3文件里面也没有php5isapi.dll,取而代之的是php5nsapi.dll,换句话说PHP5.3以后的版本就不再用ISAPI进行扩展在IIS里运行了,那有没有什么办法让PHP5.3在IIS里运行的呢,当然有了,那就是FastCGI。据说它的效率很高的哟。”