XAMPP启动Apache服务失败“Error: Apache shutdown unexpectedly,This may be due to a blocked port, missing dependencies,improper privileges, a crash, or a shutdown by another method”的解决办法

分类:计算机 | 其它 | 个人博客 | WordPress 1340
更新:2022-01-15 10:26:20
编辑

1 异常说明

在XAMPP启动Apache服务时启动失败,启动界面报错“Error: Apache shutdown unexpectedly,This may be due to a blocked port, missing dependencies,improper privileges, a crash, or a shutdown by another method”。

2 异常分析

刚开始以为是Apache的启动端口被占用了,于是使用端口占用查看命令:

netstat -ano|findstr 8092

看了一下,Apache的启动端口并没有被哪个进程占用,而且即使换了端口重新启动Apache服务还是会失败,报一样的错误。

看来有可能不是端口被占用的问题,那么问题出在哪呢,还是得看一下日志,于是到XAMPP控制面板中点击Apache管理区域中的“Logs”——Apache(error.log)中看了一下错误日志,发现里面确实有报错日志:

'C:\\WINDOWS\\SYSTEM32\\VCRUNTIME140.dll' 14.0 is not compatible with this PHP build linked with 14.28 in Unknown on line 0

网上查了一下这个错误,网上有一种说法是“vcruntime140.dll和php两个关键字联系在一起,并且是windows,那就肯定是 Microsoft Visual C++ 2015-2019 Redistributable (x64) 出了问题”,按照这个思路,那么应该是自己的电脑上没有安装 Microsoft Visual C++ 2015-2019 Redistributable (x64)或者这个安装的有问题。

于是跑去控制面板的程序管理界面看了一下,发现程序里已经安装了 Microsoft Visual C++ 2015-2019 Redistributable (x64)呀,那么难道是安装的有问题?

3 异常解决

最后又在网上查了一下,果然有人遇见过这种情况,就是把 Microsoft Visual C++ 2015-2019 Redistributable (x64)给修复了一下就好了。于是我在控制面板的程序管理界面中选中Microsoft Visual C++ 2015-2019 Redistributable (x64),右键——点击“更改”——点击“修复”。

修复完成后重启电脑,再次启动Apache服务,果然好了,厉害!

参考资料

https://www.laoliang.net/jsjh/technology/9159.html

https://blog.csdn.net/weixin_50052475/article/details/114400161