WampServer启动后,服务器状态显示为在线,但是图标为黄色,然后开始检查问题原因:
1.首先检查端口占用情况,httpd.conf中配置的监听端口为Listen localhost:8088,通过netstat -ano|findstr "8088",并未发现端口被占用。
2.查看wamp服务,win+R,输入services.msc,按名称排序,找到wampmysqld和wampapache服务,发现wampmysqld服务正常启动,而wampapache服务则是未启动状态。手动重启后,弹出错误框。
3.没有从中获取到有价值的信息,于是在右键计算机->管理->事件查看器->Windows日志->应用程序中查看来源为Apache Service的错误信息,共三条:
The Apache service named reported the following error:
>>> (OS 10048)通常每个套接字地址(协议/网络地址/端口)只允许使用一次。 : AH00072: make_sock: could not bind to address 127.0.0.1:8088 .
The Apache service named reported the following error:
>>> AH00451: no listening sockets available, shutting down .
The Apache service named reported the following error:
>>> AH00015: Unable to open logs .
4.经过各种查询始终没有解决,直到将httpd.conf中配置的监听端口改为Listen 127.0.0.1:8088后,启动服务成功,WampServer图标变为绿色。
原因:由于在改动host文件时,不小心复制了一行127.0.0.1 localhost,导致无法解析localhost,所以wampapache服务不能正常启动。
去掉一行后,将httpd.conf中的配置还原为Listen localhost:8088后,服务启动正常。