【转载】http://blog.csdn.net/luomoshusheng/article/details/44653615
问题描述
最近在搞点web,装了XAMPP,在启动apache的时候就郁闷了,
18:22:07 [Apache] Error: Apache shutdown unexpectedly.
18:22:07 [Apache] This may be due to a blocked port, missing dependencies,
18:22:07 [Apache] improper privileges, a crash, or a shutdown by another method.
18:22:07 [Apache] Press the Logs button to view error logs and check
18:22:07 [Apache] the Windows Event Viewer for more clues
18:22:07 [Apache] If you need more help, copy and post this
18:22:07 [Apache] entire log window on the forums
解决办法
经过一番研究,原来是MainPort和SSLPort的问题,建议先在cmd中执行(安装路径)\xampp\apache\bin\httpd.exe,然后根据cmd中的提示,来解决。
-
第一种解决办法
- cmd 通过运行\xampp\apache\bin\httpd.exe,打印如下: 通常每个套接字地址(协议/网络地址/端口)只允许使用一次。 : make_sock: could not bind to address 0.0.0.0:80 或[ : : ]:80
在/xampp/apache/conf/extra/httpd.conf 把Listen 80 修改为 88 (可自定义) - 满怀信心,再执行\xampp\apache\bin\httpd.exe,打印如下: 通常每个套接字地址(协议/网络地址/端口)只允许使用一次。 : make_sock: could not bind to address
0.0.0.0:443 在/xampp/apache/conf/extra/httpd-ssl.conf 把Listen 443 修改为 444(可自定义)
- cmd 通过运行\xampp\apache\bin\httpd.exe,打印如下: 通常每个套接字地址(协议/网络地址/端口)只允许使用一次。 : make_sock: could not bind to address 0.0.0.0:80 或[ : : ]:80
-
最直接的方法是关闭占用80、443端口的进程:
1.通过cmd中netstat -ano 看看本机80、443端口被占用没这里可能会被其他程序占用如iis、虚拟机等
2.通过cmd中打印tasklist,查找占用80、443端口的进程名称。
3.taskkill /pid 端口号 杀掉此进程名称,XAMPP重启apache即可。
推荐第一种办法。
补充:还有一种情况我没遇到,参考网上说的。如果配置了vhosts的话请把httpd-vhosts.conf 中端口改为88(同上端口号)