win10+Xampp7.4+,报错“Error: Apache shutdown unexpectedly. This may be due to a blocked port, missing dependencies...”的一个解决方法

{{ time }}

Xampp 7.4+安装好后,启动Apache可能发生如下报错

(安装好之后,我什么都没有做,并且也没装IIS)

15:30:37  [Apache] 	Error: Apache shutdown unexpectedly.
15:30:37  [Apache] 	This may be due to a blocked port, missing dependencies, 
15:30:37  [Apache] 	improper privileges, a crash, or a shutdown by another method.
15:30:37  [Apache] 	Press the Logs button to view error logs and check
15:30:37  [Apache] 	the Windows Event Viewer for more clues
15:30:37  [Apache] 	If you need more help, copy and post this
15:30:37  [Apache] 	entire log window on the forums

有人说是80或443端口被占用了,可是我都没有装IIS,并没有占用这2个端口。

上面的报错说让看log

在Xampp面板->apache->logs按钮->Apache(error.log)中,可以看到,内部报错如下

PHP Warning:  'vcruntime140.dll' 14.0 is not compatible with this PHP build linked with 14.16 in Unknown on line 0

这是一个C++支持包的问题

解决方法是

点这个网址:https://visualstudio.microsoft.com/zh-hans/downloads/

然后搜索“Microsoft Visual C++ Redistributable for Visual Studio 2019”

然后下载并安装。

如下图