首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> 網頁程式設計 >> PHP 程式設計 >> PHP 綜合知識

IIS 7+ 啟用 FastCGI 支援 PHP 完整圖文教學

     編輯:PHP 綜合知識

適用於 Windows 7、Vista SP1、Server 2008/R2 的 IIS 7.0+ 環境,手動啟用 FastCGI 模組讓 PHP 正常運作。

Windows 7 / Vista SP1 啟用步驟

  1. Win+R → optionalfeatures.exe → Enter
  2. 展開:Internet Information Services → World Wide Web Services → Application Development Features
  3. 勾選 CGI → OK 等待安裝完成

Windows Server 2008 / R2 啟用步驟

  1. Win+R → CompMgmtLauncher → 開啟伺服器管理員
  2. 若無 Web Server (IIS) 角色:Add Roles → 選擇 Web Server
  3. 已有角色:Add Role Services → Application Development → CGI 勾選
  4. Next → Install 完成

後續 PHP 部署要點

  • 下載 PHP Windows 版(Non Thread Safe for IIS)
  • 解壓至 C:\PHP,複製 php.ini-production 為 php.ini
  • 修改 php.ini:cgi.force_redirect = 0、fastcgi.impersonate = 1、設定 extension_dir 絕對路徑
  • IIS 管理員 → Handler Mappings → Add Module Mapping:
    • Request path: *.php
    • Module: FastCgiModule
    • Executable: C:\PHP\php-cgi.exe
    • Name: PHP via FastCGI
  • 設定 FastCGI Settings → Environment Variables → PHP_FCGI_MAX_REQUESTS=10000

完成後建立 phpinfo.php 驗證,Server API 應顯示 CGI/FastCGI。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved