How to Solve VCRUNTIME140.dll Not Compatible With PHP Build


Sometimes, when using current releases of PHP on Windows systems, you may encounter a PHP warning about vcruntime140.dll not compatible with the PHP build. For example, you may encounter such PHP warning when using the recently released PHP 8.4 on a Windows system.

In the following image, a command to check the version of PHP installed on a Windows system generates a vcruntime140.dll not compatible with PHP build warning:

The cause of this PHP warning in Windows is usually due to obselete Microsoft Visual C++ Redistributable runtime libraries installed on the Windows system.

The solution to this issue, in most cases, involves downloading the latest versions of Microsoft Visual C++ Redistributable packages, and then installing them on the Windows system.

In this post, we will learn to understand why this PHP warning is generated on a Windows system, and then look at the solution to eliminate the warning. We will use PHP 8.4 as the base build for the examples used in this post.

As indicated earlier, the solution to this issue mostly involves downloading the latest releases of Microsoft Visual C++ Redistributable packages and installing them on Windows. However, it will be helpful to understand why this PHP warning is generated. The sections that follow take in-depth look at the cause.

Check Installed Microsoft Visual C++ Redistributable

To check the version of Microsoft C++ Redistributable runtime libraries installed on a Windows system, click on Settings from the start menu, marked in red in the image below:

From the Windows Settings page, click on Apps to display installed applications. Scroll down to see installations of Microsoft Visual C++ Redistributable packages in the list. The list of installed applications is ordered alphabettically, so you can easily find them in the list.

On your Windows system, you will most likely see multiple installations of Microsoft Visual C++ Redistributable packages. For example, the following image shows multiple installations of the runtime libraries:

From your list, click on the most recent package, for either x86 (32-bit) or x64 (64-bit) architecture. For example, in the list above, the most recent package is Microsoft Visual C++ 2015-2022 Redistributable.

After clicking on it, you should see the version of your most recent Microsoft Visual C++ Redistributable package, such as marked below:

The version of the Redistributable package, marked in red above, is the version number reported in the PHP warning of vcruntime140.dll that we saw earlier. For convenience, the reported PHP warning is shown below with the incompatible version number marked in red:

The warning message above tells that the version of Microsoft Visual C++ Redistributable 2015-2022 runtime libraries installed on the Windows system is not compatible with the Microsoft Visual C++ tools used to build the PHP version in use.

For example, we can say that the version of the build tools used to develop PHP 8.4 is version 14.42, marked in green in the image above. Meanwhile, the version of the recent Microsoft Visual C++ runtime libraries installed on the Windows system is 14.38, marked in red in the same image.

Solving The Incompatibility Issue

To resolve this issue, we will need to update the Microsoft Visual C++ Redistributable runtime libraries to a version that is higher than or equal to the version of the build tools used to develop the PHP version for which the warning is reported.

We can get the latest Microsoft Visual C++ Redistributable packages by downloading them from Microsoft website.

Download Latest Microsoft Visual C++ Redistributable

To download and install the latest Microsoft Visual C++ Redistributable runtime libraries, visit the latest supported Redistributable packages page at the official Microsoft website. Scroll down to see the latest version available for download. A sample view is shown below:

We can see from above that the latest version of the Redistributable package is version 14.42. Scroll down to see the download links for x86 (32-bit) and x64 (64-bit) architecture.

Click on a link to download the Redistributable package for the architecuture you want. It is however recommended to download packages for both x86 and x64 architecture if your Windows system has installations for both.

Install Latest Redistributable Packages

After downloading the latest release of Microsoft Visual C++ Redistributable packages, click on the installer files to begin installation. This will launch the installer dialog box, as seen below:

You will need to agree to the license terms and conditions in order to install the runtime libraries. Go ahead and install the Redistributable package. You can repeat this for the other architecture so that you will have recent versions for both x86 and x64 architecture.

Confirm Updated Microsoft Visual C++ Redistributable Installations

After installing the latest versions of Microsoft Visual C++ Redistributable packages, you can check to verify that you have the latest versions installed by checking from the Apps and Features page. Scroll down to see the list of installed Microsoft Visual C++ Redistributable packages.

Click on the most recent package, such as Microsoft Visual C++ Redistributable 2015-2022. You should now see that your Microsoft Visual C++ Redistributable runtime libraries have been updated. The following is a sample view showing the updated version.

We can also run a PHP command to confirm that the PHP warning about vcruntime140.dll not compatible with the PHP version in use is eliminated.

From a command prompt window, or from Powershell, type and execute the following command:

Bash
php -v

This will display the version of PHP in use without the warning message. An example is shown below:

In this example, PHP 8.4 is now compatible with the version of Microsoft Visual C++ Redistributable runtime libraries that have been installed on the Windows system. The vcruntime140.dll incompatibility warning message does not show anymore.

Wrapping Up

When using latest releases of PHP, you may encounter warnings about vcruntime140.dll not compatible with the PHP build in use. For example, current releases of PHP 8.4 require at least version 14.42 of Microsoft Visual C++ 2015-2022 Redistributable runtime libraties.

To eliminate this warning, the latest version of Microsft Visual C++ Redistributable packages have to be downloaded and installed on the Windows system.


Leave a Reply

Your email address will not be published. Required fields are marked *