88

I have downloaded PHP 7.4.1 NTS vc15 x86 on a Windows Server 2016 machine. I have also downloaded and installed vc_redist.x86.exe.

When I try and run php-cgi from the command prompt I get the following error:

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

Any ideas on how to resolve this? I guess I could install an older version of PHP from the archives but this doesn't really address the problem.

13 Answers 13

166

Turns out PHP 7.4.x requires Microsoft Visual C++ Redistributable for Visual Studio 2019 which can be downloaded here under the heading Other Tools and Frameworks

6
  • 2
    This also broke my coworker's laragon after she update to 7.4. Thanks for sharing. Jan 17, 2020 at 9:19
  • 4
    From 2015 to 2019: support.microsoft.com/en-us/help/2977003/…
    – Ziyad
    Jan 24, 2020 at 13:25
  • Solved my problem too. Thank you.
    – luisdev
    Mar 20, 2020 at 13:07
  • 4
    Weirdly, this solved my Error: Apache shutdown unexpectedly problem. I started getting the error after updating XAMPP, and I thought the problem was about ports, but guess not.
    – akinuri
    Apr 22, 2020 at 14:15
  • 1
    Important: Use the 64 Bit version if you have 64 Bit PHP - otherwise the x86 version
    – ESP32
    May 30, 2020 at 17:45
16

if you are using xampp, go to apache folder C:/xampp/apache/bin... rename the vcruntime140.dll to vcruntime140.dll,old hope it works..

2
  • This is the best Answer by far !! i have been running around like a maniac trying to fix this thing on Xampp for days, i literally tried every answer on this topic and got frustrated almost change my OS for this ....... thanks man You're the best Feb 22 at 19:30
  • I installed latest compatible C++, restarted, but it didn't work. But when I did what you advised here, it worked. But what happened behind the scenes?
    – 1amroff
    May 26 at 8:53
15

I had the same problem. After I downloaded the latest version of Microsoft Visual C++, I successfully solved this problem. You can download it here . https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads

2
  • Thanks, after installing them and do a restart everything is working.
    – user7153178
    May 12, 2020 at 21:24
  • I had this issue when installing Local by flywheel, it failed silently in the background, this fix allowed me to get up and running with PHP8
    – rmorse
    Apr 13, 2021 at 15:28
10

If this issue occurs when trying to integrate Command Line Tools into JetBrains PhpStorm 2019.3.x, check out the current status of this PhpStorm issue, and if it's not fixed in the latest version, use the VC runtime copy workaround described here:

Ensure to install MS VC Redist 2017, which has new vcruntime140.dll file, then:

Manually update/replace vcruntime140.dll at C:\Users\UserName\AppData\Local\JetBrains\PhpStorm 2019.x\jbr\bin (if installed local), or C:\Program Files\JetBrains\PhpStorm 2019.x\jbr\bin directory.

6

I have downloaded and installed vc_redist.x64.exe file from here: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads and It works for me. If you face the same error it will surely work for you

2
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – Edwin
    Dec 30, 2021 at 7:55
  • It works for me. Aug 4 at 10:35
5

Downloaded and installed vc_redist.x64.exe file from here: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads and It works fine

3

Install a compatible version through this link https://support.microsoft.com/pt-br/help/2977003/the-latest-supported-visual-c-downloads

3

hello there i found nice soulution for this without install vc-redist perfect for win7

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

you need first to go to C:\Windows\System32 search for vcruntime140.dll rename it vcruntime140_backup.dll second thing is go to xampp path for example C:\xampp\mysql\bin search for the same file vcruntime140.dll copy & paste into C:\Windows\System32

Congratulation.

2

When using XAMPP Server on Windows whilst using the Laravel Framework to create a website the console logged an error when running the server "vcruntime140.dll 14.0 not compatible with PHP build".

I found the top answer on this page and installed Microsoft Visual C++ Redistributable for Visual Studio 2019 and when I ran the server again it still retuned an error. I noticed from the error log that after the PHP update PHP was being read directly from the C drive.

If you are using XAMPP Server the easiest fix is to copy the PHP folder located at C:\xampp\php and paste it directly to your C:\ drive.

The best method is to update XAMPP.

1

Since I kept getting this error although vcredist was newly installed, I checked the vcredist files themselves. It turned out that there was an orphan vcredist file in the apache/bin folder which caused the problem.

1

if you are using xampp method 1 : download vcruntime14.dll file from (www.dll-files.com) replace the downloaded file in Xammpp\apache\bin

method 2: if you have visual studio 2015 or above installed on you system goto windows\system32 and search for vcruntime14.dll and copy that file and replace it with vcruntime14.dll exists in Xammpp\apache\bin

0

PHP for Windows requires Microsoft C and C++ (MSVC) runtime libraries and VCRUNTIME140.dll is the main library. You have an older version than the current PHP version was built with. Update MSVC to the latest version and you will be fine.

I wrote more information about this to the blog https://blog.devsense.com/2022/fix-php-warning-vcruntime140.dll since I've been asked about this multiple times.

-2

download and run exe from the bellow link. https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170

Not the answer you're looking for? Browse other questions tagged or ask your own question.