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。

 

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