Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

Win8 系統解決 XAMPP Apache 佔用 80 埠衝突:停用 HTTP 服務與修改登錄完整步驟

編輯:Win8 系統應用技巧

在 Windows 8 安裝 XAMPP 時,Apache 常因系統預設佔用 80 埠(HTTP Service)而無法啟動。本文提供徹底解決方案:停用並禁用 HTTP 服務、修改登錄啟動類型、重開機驗證,確保 80 埠釋放給 Apache 使用。

問題現象

  • XAMPP Control Panel 中 Apache 模組顯示錯誤或無法啟動。
  • 執行 netstat -ano | findstr :80 發現 PID 4 (System) 佔用 0.0.0.0:80。

解決步驟(需系統管理員權限)

1. 以管理員身分開啟命令提示字元

按 Win+X → 選擇「命令提示字元 (系統管理員)」或「Windows PowerShell (系統管理員)」。

2. 停用 HTTP 服務

net stop http

成功訊息:HTTP Service 服務已成功停止。

3. 驗證 80 埠已釋放

netstat -ano | findstr 0.0.0.0:80

若無輸出結果,表示 80 埠已無程序佔用。

4. 將 HTTP 服務設為「已停用」,防止開機自動啟動

sc config http start=disabled

成功訊息:[SC] ChangeServiceConfig 成功

5. 修改登錄確保服務不再自動啟動(雙重保險)

  1. 按 Win+R 輸入 regedit 開啟登錄編輯器。
  2. 瀏覽至:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\HTTP
  3. 在右側找到 Start 值,雙擊修改數值資料為 0(十六進位)。
  4. 按確定關閉登錄編輯器。

6. 重新開機

重啟電腦,System 進程將不再佔用 80 埠,XAMPP Apache 即可正常啟動。

補充說明

  • 為何要改登錄? sc config 有時在某些環境下不生效,直接修改 Start=0(SERVICE_DISABLED)為根治。
  • 其他常見佔用 80 埠程式:IIS (World Wide Web Publishing Service)、Skype、VMware Workstation、TeamViewer 等。若上述步驟後 Apache 仍無法啟動,請檢查並停用這些服務。
  • 替代方案:將 Apache 監聽埠改為 8080 或其他(修改 httpd.conf 中的 Listen 80),但建議優先釋放 80 埠以保持標準。

驗證 Apache 正常啟動

  1. 開啟 XAMPP Control Panel,點擊 Apache 模組「Start」。
  2. 狀態顯示綠色「Running」,PID 與 Port 顯示 80。
  3. 瀏覽器輸入 https://localhost 或 https://127.0.0.1,出現 XAMPP 歡迎頁面即成功。

快速指令摘要(複製貼上至管理員 CMD)

net stop http
netstat -ano | findstr 0.0.0.0:80
sc config http start=disabled
reg add "HKLM\SYSTEM\CurrentControlSet\services\HTTP" /v Start /t REG_DWORD /d 0 /f
shutdown /r /t 0

最後一行 shutdown /r /t 0 為立即重開機,可選擇手動重啟。

總結

Windows 8 內建 HTTP Service 佔用 80 埠是 XAMPP Apache 無法啟動的主因。透過「停用服務 → 設為禁用 → 登錄強制停用 → 重開機」四步驟,可徹底釋放 80 埠,讓 Apache 順利運行。操作簡單、效果永久,建議所有 Win8 上架設 XAMPP 的開發者執行此設定。

Copyright © Windows教程網 All Rights Reserved