今天好端端的PHPstudy的Apache居然启动不了:
![9125154-102f199f599aa7f2.png](https://upload-images.jianshu.io/upload_images/9125154-102f199f599aa7f2.png)
去控制面板中的服务手动启动,竟报这个错:
![9125154-976f27c3c65f5e84.png](https://upload-images.jianshu.io/upload_images/9125154-976f27c3c65f5e84.png)
查了一些博文,发现应该是80端口
被占用了,
解决方法方法:
Win+R、cmd,打开命令行窗口:
输入:
netstat -ano|findstr "80"
![9125154-9eb7242c134bb42d.png](https://upload-images.jianshu.io/upload_images/9125154-9eb7242c134bb42d.png)
可以看到
输出结果中的第一行
显示着:80端口
被进程4
占用。
输入:
Tasklist |findstr 4
可以看到进程4是某个系统服务:
![9125154-62228fc9bd303143.png](https://upload-images.jianshu.io/upload_images/9125154-62228fc9bd303143.png)
然而系统服务我们是无法禁止的,只能更改其占用端口,让它不要占用我们的80端口:
具体操作可以参考 这篇博文。
另外除了系统服务,我查到一篇博文,说是下面这个服务也会占用到80端口,而且它是自动的,所以我们要先把它关闭掉,再启动Apache去占用80端口,之后这个服务可能会自动启动,但这时80端口已经被我们启动的Apache占用,这个服务便会自行去占用其他端口,Apache便成功运行:
![9125154-678bec81f2e41c9f.png](https://upload-images.jianshu.io/upload_images/9125154-678bec81f2e41c9f.png)
![9125154-cb20ea5fc9fa8749.png](https://upload-images.jianshu.io/upload_images/9125154-cb20ea5fc9fa8749.png)
另外两篇参考文章: