When running PHP on IIS in Windows Server, you may encounter a 500 Internal Server Error while loading PHP pages.
This issue is commonly caused by a mismatch between the PHP build and the installed Visual C++ runtime library.
You might see the below error while you install PHP on the Windows server with IIS and run any of the PHP pages.

When accessing a PHP page in IIS, it returns 500 Internal Server Error.

While we run the php-m command in the command prompt, it gives the following warning.
PHP Warning: ‘vcruntime140.dll’ 14.0 is not compatible with this PHP build linked with 14.16 in Unknown on line 0
As per the warning, we need to upgrade the Visual C++ runtime to the latest version. Here, we will upgrade it to Visual ++ 2015-2019. You need to install it as per your system require,ments whether it is x64 or x86.
Cause:
The installed Microsoft Visual C++ runtime is outdated and does not match the required version for PHP.
Solution:
Step 1: Download the Latest Visual C++ Redistributable
You need to install the updated Visual C++ 2015–2019 Redistributable package.
- For 64-bit systems (x64) → Download vc_redist.x64.exe
- For 32-bit systems (x86) → Download vc_redist.x86.exe
You can install both if you are unsure which one is required.
Step 2: Install the Redistributable
Run the downloaded installer. Follow the on-screen instructions and complete the installation.
Restart IIS using the command:
# iisreset
Step 3: Verify
Run php -m again to confirm there are no warnings.
Reload your PHP page in IIS, and it should now work without the 500 Internal Server Error.
Conclusion:
The 500 Internal Server Error for PHP 7.4 on IIS is caused by an outdated Visual C++ runtime library. Installing the latest Visual C++ 2015–2019 Redistributable (x64/x86) resolves the issue and allows PHP to run smoothly on Windows Server.
