跳轉到內容

IIS 和 FastCGI/註冊直譯器

來自華夏公益教科書,開放的書籍,為開放的世界

此頁面主要是一個官方 Microsoft 文件的維基映象。[1]

配置 FCGI.ini

[編輯 | 編輯原始碼]

全域性註冊擴充套件

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

## perl
cscript fcgiconfig.js -add -section:"Perl" -extension:pl -path:"C:\strawberry\perl\bin\perl.exe"

要註冊特定於站點的擴充套件,只需新增 -site=<sitenum> 標誌。(沒有尖括號)

cscript fcgiconfig.js -add -section:"PHP" -extension:php -path:"C:\PHP\php-cgi.exe" –site:1

成功後,您應該看到

Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

INI successfully written.

完成 fcgiext.ini

[編輯 | 編輯原始碼]

文件預設位於C:\WINDOWS\system32\inetsrv\fcgiext.ini

FastCGI 文件使用型別部分將 FastCGI 應用程式對映到 IIS 站點(虛擬主機)上,使用特定的 IIS ID。以及一個描述應用程式的部分

[Types]
;619896678 is my example IIS site id
*:619896678=Catalyst

[Catalyst]
ExePath=C:\strawberry\perl\bin\perl.exe
Arguments="D:\Inetpub\www\DMApp\script\dmapp_fastcgi.pl"

在 IIS 中註冊 FCGI

[編輯 | 編輯原始碼]

要將 FastCGI 新增到站點,請按照以下步驟操作:開始 → 管理工具 → Internet Information Services (IIS) 管理器 → 右鍵單擊 網站 資料夾屬性 → 主目錄 → 配置 → 選擇您安裝的擴充套件 → 編輯 → 您應該看到C:\WINDOWS\system32\inetsrv\fcgiext.dll或類似的可執行檔案欄位中的內容。取消選中“驗證檔案存在”。

故障排除

[編輯 | 編輯原始碼]

ScriptMap 已經存在

  • 示例
C:\WINDOWS\system32\inetsrv\fcgiconfig.js(1223, 5) (null): ScriptMap already exi
sts, path=IIS:///W3SVC, scriptmap=.pl,C:\Perl\bin\perl.exe "%s" %s,5,GE
T,HEAD,POST
  • 原因:通常是舊的 Active State CGI 垃圾
  • 解決方案:開始 → 管理工具 → Internet Information Services (IIS) 管理器 → 右鍵單擊 網站 資料夾屬性 → 主目錄 → 配置 → 刪除所有衝突的擴充套件,例如 .pl、.plex、.plx、.php、.rb 等 → 確定 / 確認
  • ^ 基於 Microsoft 慷慨提供的示例的資訊"使用 FastCGI 在 IIS 6.0 和 IIS 5.1 上託管 PHP 應用程式". IIS 和 FastCG. Microsoft. 2007-09-24. 檢索於 2008-02-05.
華夏公益教科書