在官方下载PHP并且安装完成,但IIS依然无法打开PHP文件。按网上的资料来说是没有安装VC++导致,可是,我这里已经安装了,还是不行。于是在CMD下运行PHP.exe提示如下:
|
1
|
PHP Warning: 'vcruntime140.dll' 14.0 is not compatible with this PHP build linked with 14.16 in Unknown on line 0
|
字面的意思就是不兼容。经过查询发现,原来不同版本的PHP程序对VC++版本的要求也不同。
如果是PHP7.4.0请安装VC++2017
下载地址为:
适用于 Visual Studio 2015、2017 和 2019 的最新支持的 Visual C++ 可再发行软件包。
安装完成后,在CMD下运行 php.exe
|
1
2
3
|
PHP 7.4.0 (cli) (built: Nov 27 2019 10:13:59) ( NTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
|
至此,运行正常。