没有不值得去解决的问题,也没有不值得去学习的技术!

Troubleshooting php-cgi.exe Failures in Windows 10 Pro

Troubleshooting analysis of PHP failing to run in Windows 10 Pro. Executing the command: php-cgi.exe -b 127.0.0.1:9000-c C:/php-7.4.27/php.ini, it exits automatically.

1. Troubleshooting analysis of PHP failing to run in Windows 10 Pro. Executing the command: php-cgi.exe -b 127.0.0.1:9000-c C:/php-7.4.27/php.ini, it exits automatically. As shown in Figure 1

Troubleshooting analysis of PHP failing to run in Windows 10 Pro. Executing the command: php-cgi.exe -b 127.0.0.1:9000-c C:/php-7.4.27/php.ini, it exits automatically.
Figure 1

2. Install the Visual C++ 2015 Redistributable 64-bit, as shown in Figure 2

Install the Visual C++ 2015 Redistributable 64-bit
Figure 2

3. Execute the command again: php-cgi.exe -b 127.0.0.1:9000-c C:/php-7.4.27/php.ini, and an error occurs: PHP Warning: ‘vcruntime140.dll’ 14.0 is not compatible with this PHP build linked with 14.16 in Unknown on line 0. As shown in Figure 3

Execute the command again: php-cgi.exe -b 127.0.0.1:9000-c C:/php-7.4.27/php.ini, and an error occurs: PHP Warning: 'vcruntime140.dll' 14.0 is not compatible with this PHP build linked with 14.16 in Unknown on line 0
Figure 3
Plaintext

PS C:\php-7.4.27> php-cgi.exe -b 127.0.0.1:9000-c C:/php-7.4.27/php.ini
PHP Warning:  'vcruntime140.dll' 14.0 is not compatible with this PHP build linked with 14.16 in Unknown on line 0
PS C:\php-7.4.27>

4. Restarting the computer still results in the same error. Reference URL: https://www.shuijingwanwq.com/2019/01/24/3139/ , the VC15 version requires installing the Visual Studio 2017 x64 or x86 Visual C++ Redistributable. Download and install the Microsoft Visual C++ Redistributable for Visual Studio 2017. Install the Visual C++ 2017 Redistributable 64-bit. The error no longer occurs. As shown in Figure 4

Install the Visual C++ 2017 Redistributable 64-bit. The error no longer occurs.
Figure 4
Plaintext

PS C:\Windows\system32> php-cgi.exe -b 127.0.0.1:9000-c C:/php-7.4.27/php.ini
PHP Warning:  'vcruntime140.dll' 14.0 is not compatible with this PHP build linked with 14.16 in Unknown on line 0
PS C:\Windows\system32> php-cgi.exe -b 127.0.0.1:9000-c C:/php-7.4.27/php.ini

5. Execute the command: php -v, and the PHP version is displayed correctly. As shown in Figure 5

Execute the command: php -v, and the PHP version is displayed correctly.
Figure 5
Plaintext

PS C:\Windows\system32> php -v
PHP 7.4.27 (cli) (built: Dec 14 2021 19:52:13) ( ZTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
PS C:\Windows\system32>

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系