XAMPP架站時,Apache啓動報錯 Error: Apache shutdown unexpectedly.

出現問題:通過XAMPP架站時,Apache啓動不成功,報錯如下:

10:02:35  [Apache] Error: Apache shutdown unexpectedly.
10:02:35  [Apache] This may be due to a blocked port, missing dependencies, 
10:02:35  [Apache] improper privileges, a crash, or a shutdown by another method.
10:02:35  [Apache] Press the Logs button to view error logs and check
10:02:35  [Apache] the Windows Event Viewer for more clues
10:02:35  [Apache] If you need more help, copy and post this
10:02:35  [Apache] entire log window on the forums

錯誤的原因:XAMPP的設置的常用端口http和https的端口都被佔用。一般會是虛擬機等佔用了。

解決辦法:

進入xampp安裝目錄,此處打開cmd窗口(路徑框輸入cmd),再運行apache/bin/httpd.exe ,會打印如下log: 
(OS 10048)通常每個套接字地址(協議/網絡地址/端口)只允許使用一次。 : make_sock: could not bind to address 0.0.0.0:443 
或者後面是80端口被佔用
(OS 10048)通常每個套接字地址(協議/網絡地址/端口)只允許使用一次。 : make_sock: could not bind to address 0.0.0.0:80  或[ : : ]:80 


方法一:修改端口號:
1、443端口被佔用,apache無法監聽443端口,在/xampp/apache/conf/extra/httpd-ssl.conf 把Listen 443 修改爲 444(可自定義)
2、80端口被佔用,apache無法監聽80端口,在/xampp/apache/conf/extra/httpd.conf 把Listen 80 修改爲 88 (可自定義)
如果配置了vhosts的話請把httpd-vhosts.conf 中端口改爲88(同上端口號)

按照網上辦法修改端口爲444後,重新啓動,會出現依然打不開的現象。log如下:

15:19:19  [main]     Starting Check-Timer
15:19:19  [main]     Control Panel Ready
15:19:23  [Apache]     Attempting to stop Apache (PID: 10976)
15:19:23  [Apache]     Attempting to stop Apache (PID: 5208)
15:19:23  [Apache]     Status change detected: stopped
15:24:42  [Apache]     Problem detected!
15:24:42  [Apache]     Port 443 in use by ""D:\Soft\VMware\VMware Workstation\vmware-hostd.exe" -u "C:\ProgramData\VMware\hostd\config.xml"" with PID 9212!
15:24:42  [Apache]     Apache WILL NOT start without the configured ports free!
15:24:42  [Apache]     You need to uninstall/disable/reconfigure the blocking application
15:24:42  [Apache]     or reconfigure Apache and the Control Panel to listen on a different port

出現這種現象時,繼續重新修改端口號,443改爲4430,然後再啓動,就好了。

方法二:關閉佔用80、443端口的進程
1. cmd中輸入netstat -ano 看看本機80、 443端口是否被佔用。
2. cmd中輸入tasklist,查看佔用80、443端口的進程名稱。 
3. taskkill /pid 端口號,殺掉此進程,XAMPP重啓apache。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章