今天启动Apache时总是启动失败,提示如下:
15:45:28 [Apache] Attempting to start Apache service...
15:45:32 [Apache] Status change detected: running
15:45:33 [Apache] Status change detected: stopped
15:45:33 [Apache] Error: Apache shutdown unexpectedly.
15:45:33 [Apache] This may be due to a blocked port, missing dependencies,
15:45:33 [Apache] improper privileges, a crash, or a shutdown by another method.
15:45:33 [Apache] Press the Logs button to view error logs and check
15:45:33 [Apache] the Windows Event Viewer for more clues
15:45:33 [Apache] If you need more help, copy and post this
15:45:33 [Apache] entire log window on the forums
查看log日志发现是80端口被占用,通常出现这种问题还可能是因为443端口被占用,这里总结一下解决方法:
1.(1)443端口被占用
在/xampp/apache/conf/extra/httpd-ssl.conf ,把Listen 443 修改为 Listen 444(可自定义);
(2)80端口被占用
在/xampp/apache/conf/extra/httpd.conf ,把Listen 80 修改为Listen 88 (可自定义)
也可以在XAMPP面板上直接进行修改
打开Config选项,打开第一项Appach(httpd.conf),将Listen 80修改为Listen 88
接着打开第二项Apache(httpd-ssl.conf),将Listen 443修改为Listen 444.这里修改的端口并不固定,可以任意。
2.最直接的解决方式是直接把占用了端口号的进程kill掉,但是这里并不推荐此种方法,因为下次启动的时候可能还会遇到这种问题。