Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> 電腦軟體教學 >> 伺服器技術 >> 關於伺服器

Windows Server 2008 IIS 7 運行 PHP 完整配置教學

編輯:關於伺服器

本文詳解如何在 Vista / Windows Server 2008 的 IIS 7 下啟用 PHP 支援。實測 Win2008 運行 PHP 效能提升 40% 以上。

系統環境

Vista / Windows Server 2008

步驟一:安裝 IIS 7

控制台 → 程式和功能 → 開啟或關閉 Windows 功能。預設選項外,務必勾選 ISAPI 兩個選項。安裝完成,瀏覽器輸入 https://127.0.0.1 應見 IIS 7 歡迎頁。

步驟二:安裝 PHP

  1. 下載 Windows Binaries:php.net,安裝至 D:\php
  2. 將 php.ini-dist 改名 php.ini,編輯關鍵設定:
    • extension_dir = "D:\php" (原為 ./)
    • Windows Extensions 區塊:移除各模組前分號啟用,如 extension=php_mbstring.dll、php_gd2.dll、php_mysql.dll
  3. 儲存並複製 php.ini 至系統 windows 目錄

步驟三:IIS 7 站點與處理常式映射配置

  1. 新增應用程式集區 → .NET 版本設為「無受控代碼」
  2. 新增網站 → 開啟「讀取」與「執行腳本」權限
  3. 為網站新增 ISAPI 篩選器
  4. 新增 處理常式對應,將 D:\PHP\php5isapi.dll 加入映射

完成上述操作,即可測試 PHP 檔案是否正常運行。

Copyright © Windows教程網 All Rights Reserved