在 Windows Server + IIS 環境部署 PHP 5.3 或 5.4 應用時,瀏覽網站出現:
FastCGI Error Error Number: 14001 (0x800736b1) HTTP Error 500 - Server Error
錯誤描述通常包含亂碼,核心原因是系統缺少 Visual C++ 2008 SP1 執行階段元件。
PHP 5.3/5.4 官方 Windows 版本使用 Visual Studio 2008 (VC9) 編譯,執行時依賴 Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)。若伺服器未安裝此套件,PHP 進程啟動失敗,IIS 回傳 FastCGI 14001 錯誤。
建議:即使是 64 位元系統,若 IIS 應用程式集區設為「啟用 32 位元應用程式 = True」,仍需安裝 x86 版本。
# 以系統管理員身分執行 vcredist_x86.exe /quiet /norestart iisreset
# 命令列測試 C:\php\php.exe -v # 應顯示版本資訊,無錯誤彈窗
| PHP 版本 | 編譯器 | 所需 VC++ 版本 | 下載關鍵字 |
|---|---|---|---|
| 5.3 / 5.4 | VC9 (VS2008) | VC++ 2008 SP1 | vcredist 2008 SP1 |
| 5.5 / 5.6 | VC11 (VS2012) | VC++ 2012 Update 4 | vcredist 2012 |
| 7.0 / 7.1 | VC14 (VS2015) | VC++ 2015-2022 | vcredist 2015-2022 |
| 8.0+ | VC16 (VS2019+) | VC++ 2015-2022 | vcredist 2015-2022 |
iisreset 或回收應用程式集區。Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* |
Where-Object {$_.DisplayName -like "*Visual C++*"} |
Select-Object DisplayName, DisplayVersion
解決 VC++ 執行階段缺失是部署舊版 PHP 於 IIS 的必要步驟,完成後即可正常運行 FastCGI 處理序。