IIS 6.0 - FastCGI

11/16/2007

3 分钟可看完

本文内容

CGI application were discouraged on IIS webservers because for every request a new host process had to be spawned raising questions about performance.

The FastCGI protocol is set to change this. The concept is simple instead of creating a new host process for each request and killing it ...reuse a bunch(or single) of processes to handle the requests.

You gain significant performance improvement by reusing the process instead of killing it and creating a new one.

How do I start ?

You can download the installer here

INSTALLATION

The installation is pretty simple. It basically copies three files to your \system32\inetsrv folder. The files are

fcgiconfig.js       - Script file that can be use to configure FastCGI settings(you can change configurations manually as well)

fcgiext.dll          - The ISAPI extension that helps in passing requests to the CGI process.

fcgiext.ini         - The settings file that controls the behavior of  the FastCGI handler (If you do not feel like using fcgiconfig.js you have to tweak this file)

It also adds an entry in IIS Web Service Extensions "FastCGI Handler" and enables it.

In case you are uninstalling FastCGI extension note that the ini file is left intact on the server. In future if you reinstall FastCGi you may find some settings already configured because of this.

CONFIGURATION

FCGICONFIG.JS is the configuration script that you use to configure FastCGI settings (You can always do it manually as well)

Using fcgiconfig.js will give you a first hand experience on how changing IIS 7 configuration from command line will look.

cscript fcgiconfig.js -add -section:"PHP" - extension:php -path: "C:\php-5.2.5-nts-Win32\php-cgi.exe"

(You can use the -site switch if you want to configure only one website)

What this does is it puts an ISAPI extensions mapping for .php and points it to the fcgiext.dll

It also adds entries in the fcgiext.ini file mapping to tell the fcgi handler  which cgi executable is mapped to the .php extension.

[Types]

php=PHP

[PHP]

ExePath=C:\php-5.2.5-nts-Win32\php-cgi.exe

It then recycles the apppools in case of IIS 6.0 or restarts the service in IIS 5.0

If you have multiple mappings say for PHP and RoR then in IIS both the extensions will be mapped to fcgiext.dll but in the fcgiext.ini we will specify which executable to use to handle the requests.

The above image shows a clear difference as to how a CGI application configured with FastCGI looks. If you notice I even have the perl cgi mapped to ".pl" in the above image. It is mapped as CGI. But in case of ".php" it is mapped to the FastCGI handler(fcgiext.dll) which now in turn will invoke the "php-cgi.exe" as required.

So for every "*.pl" request a new instance of perl.exe process is created but for ".php" requests the process(es) is reused.

By default the FastCGI handler creates a pool of 10 CGI processes. This can be tweaked using the MaxInstances parameter in the ini file. The fcgiext.ini can be used to tweak the following parameters Protocol / MaxInstances / QueueLength / IdleTimeout / ActivityTimeout / RequestTimeout / InstanceMaxRequests / ResponseBufferLimit / FlushNamedPipe / UnhealthyOnQueueFull / IgnoreExistingFiles / IgnoreExistingDirectories

So now when a request is made for a php file IIS hands off the request to the fcgiext.dll ISAPI extension. The FastCGI handler then checks the association in the [Types] section. It then spawns the corresponding CGI process and hands off the request to the executable. Once the request is processed and returned back the process is not killed but kept alive till IdleTimeout (300 sec default). If another request for a php file is made the same process is reused.

iis6.0 php fastcgi,IIS 6.0 - FastCGI相关推荐

  1. iis7.0官方下载 IIS 7.0(微软Web服务器组件IIS 7.0) 官方(windows 2003,XP,2000)

    iis7.0官方安装包下载 iis7时微软为新一代web服务器开发的服务器软件,安全性较iis5\iis6都有所提高,现在很多网友在找iis7完整安装包下载地址,其实 只要你安装的是win7或者vis ...

  2. WCF 4.0 Issues with IIS 7.0 on x86 and x64 bit Machines(转载)

    If you are experienced with WCF, you know that in case of installing IIS after installing .NET frame ...

  3. IIS 7.0的集成模式和经典模式

    IIS7.0中的 Web应用程序有两种配置模式:经典模式和集成模式.经典模式是为了与之前的版本兼容,使用ISAPI扩展来调用ASP.NET运行库,原先运行于 IIS6.0下的Web应用程序迁移到IIS ...

  4. iis 6.0部署asp网站

    IIS 发布步骤 1, 程序->运行->输入inetmgr,打开IIS管理器; 2, 展开左侧树形目录->右击"网站"->新建->网站,打开网站创建向 ...

  5. IIS 7.0 的 ASP.NET 应用程序生命周期概述

    本主题介绍在 IIS 7.0 集成模式下运行以及与 .NET Framework 3.0 或更高版本一起运行的 ASP.NET 应用程序的应用程序生命周期.IIS 7.0 还支持经典模式,其行为类似于 ...

  6. IIS 7.0探索用于 Windows Vista 的 Web 服务器和更多内容

    我 经常听到 Microsoft 内部和外部的人将新的 IIS 7.0 Web 服务器称为 Microsoft 在过去几年中所进行的最重要的开发工作之一.考虑到 Microsoft 最近推出了一系列引 ...

  7. C#中操作IIS 7.0

    C#中操作IIS 7.0 作者:Jaxu 出处:博客园  2009-3-26 10:17:52 阅读 53  次 <script type="text/javascript" ...

  8. iis6.0 php漏洞,微软IIS 6.0和7.5的多个漏洞及利用方法

    微软的IIS 6.0安装PHP绕过认证漏洞 微软IIS与PHP 6.0(这是对PHP5中的Windows Server 2003 SP1的测试) 详细说明: 攻击者可以发送一个特殊的请求发送到IIS ...

  9. IIS 7.0: 使用集成的 ASP.NET 管道增强应用程序

    IIS 7.0 使用集成的 ASP.NET 管道增强应用程序 Mike Volodarsky 代码下载位置: PHPandIIS2008_01.exe (171 KB) Browse the Code ...

  10. 第二讲 Best Practices For Running IIS 6.0 And ASP.NET

    *Web Garden 一个Application pool指定多个Worker processes 某个worker processes负载过重.lock,其它的worker processes可继 ...

最新文章

  1. (转)C语言字节对齐
  2. ARM NEON 优化
  3. Android开发之百度地图经纬度转换地址(以及获取详细地址的方法自测成功)
  4. list 置顶元素_java集合指定元素排序:最前,按照提供的顺序排序?求算法
  5. java开发者工具开源版_6种开源工具可帮助教育工作者保持井井有条
  6. bootstrap的html高度很低,Bootstrap DIV没有填充100%背景颜色的高度
  7. Permission denied: make_sock: could not bind to address 端口问题解决
  8. rhel5 下cacti安装日志
  9. SSD源码解读之ssd_pascal.py
  10. 磨煤机监测参数及实际运行数据
  11. html中文字放在图片下边,css图片下边怎么加字
  12. pythonpath环境变量pth_.pth 文件扩展python环境路径
  13. python白鹅类型_SCP-CN-161 翻译器
  14. Mock.js + RAP 使用介绍
  15. mui实现二维码扫描功能
  16. 这些带斑点的蛇实在太漂亮了,盘点18种带斑点的蛇
  17. 数据库SQL经典面试题详解
  18. 「SQL数据分析系列」4.过滤操作
  19. 并发编程-初级之认识并发编程
  20. 全网最全的Kali工具大全

热门文章

  1. redis分布式锁的复杂实现
  2. Python的Turtle绘制纳兹咩的娘口三三
  3. 01-老马jQuery教程-jQuery入口函数及选择器
  4. Extjs学习(3):事件和动作
  5. nginx封锁恶意IP,并且定时取消的两种脚本
  6. [UI] 精美UI界面欣赏[11]
  7. mooon-agent核心设计图
  8. linux设置磁盘配额查看目录文件大小命令
  9. linux中如何记录时间
  10. ADSL路由切换IP