zoukankan      html  css  js  c++  java
  • IIS 6 下配置以 FastCGI 跑 PHP

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

    1.下载 FastCGI For IIS6

    http://www.iis.net/download/fastcgi

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

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

    1. fcgiext.dll – fastcgi处理程序
    2. fcgiext.ini – 配置文件
    3. fcgiconfig.js – FastCGI的控制脚本


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

    2.下载 PHP5.2.14 Windows 版

    http://www.php.net/downloads.php

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

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

    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=C:\PHP\php-5.2.14-Win32\php-cgi.exe

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

    4. 配置 php.ini

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

    打开 C:\PHP\php-5.2.14-Win32\php.ini,修改:

    extension_dir = "C:\PHP\php-5.2.14-Win32\ext" 
    fastcgi.impersonate = 1

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

    5. 配置网站

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

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

    6. 写个 php 测试下吧

    <?php 
    phpinfo(); 
    ?>

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

    打开后如果出现提示:No input file specified. 估计是没配置 fastcgi.impersonate。

    http://www.cnblogs.com/shanyou/archive/2010/11/07/1871262.html

  • 相关阅读:
    Spark 之 内存模型
    Python 之 windows上安装和pycharm 使用
    Kafka之 kafka消费->SparkStreaming|写入->Kafka|kafka消费->hbase
    SparkStreaming之 任务失败后,自动重启
    微信小程序常用赋值方法小结
    eclipse中xml文件Ctrl+左键不跳转解决办法
    SpringCloud简介以及相关组件
    spring怎么设置定时任务
    Http协议请求的不同类型
    Spring各个jar包作用
  • 原文地址:https://www.cnblogs.com/blosaa/p/2852494.html
Copyright © 2011-2022 走看看