How to Fix “MSVCR110.dll is Missing” Error When Running php-cgi.exe on Windows


2 views

When attempting to launch php-cgi.exe with Nginx on Windows, you're encountering the MSVCR110.dll missing error because PHP 5.5 requires the Visual C++ 2012 Redistributable package (specifically the x86 version for 32-bit PHP). The DLL belongs to the Microsoft Visual C++ runtime components.

You mentioned having these installed:

Visual C++ 2008 x86
Visual C++ 2010 x64
Visual C++ 2010 x86

None of these provide MSVCR110.dll, which comes from VC++ 2012 (v11.0). PHP doesn't bundle these runtime dependencies to keep the package lightweight.

First, download the correct redistributable:

# For 32-bit PHP (x86):
https://aka.ms/vs/17/release/vc_redist.x86.exe

# For 64-bit PHP (x64):
https://aka.ms/vs/17/release/vc_redist.x64.exe

After installation, verify the DLL exists in:

C:\Windows\System32\    # For 32-bit on 32-bit OS or 64-bit DLL on 64-bit OS
C:\Windows\SysWOW64\    # For 32-bit DLL on 64-bit OS

If you're managing multiple PHP versions, consider these options:

  1. Use PHP's thread-safe (TS) version which may have different VC++ requirements
  2. Switch to newer PHP versions (7.2+) that use more recent VC++ runtimes
  3. Create a batch file to check dependencies before launching:
@echo off
if not exist "%SystemRoot%\System32\msvcr110.dll" (
    echo MSVCR110.dll not found! Installing VC++ 2012...
    start /wait vc_redist.x86.exe /quiet /norestart
)
start php-cgi.exe -b 127.0.0.1:9000

Use Dependency Walker (depends.exe) to analyze all required DLLs:

depends.exe php-cgi.exe

This will show all missing dependencies in a tree view. For production servers, I recommend installing all common VC++ runtimes from 2008 through 2022 to avoid similar issues with other software.

When setting up new Windows development machines, I always run this PowerShell script to install all necessary runtimes:

$runtimes = @(
    "https://aka.ms/vs/17/release/vc_redist.x86.exe",
    "https://aka.ms/vs/17/release/vc_redist.x64.exe",
    # Add other versions as needed
)

foreach ($url in $runtimes) {
    $installer = "$env:TEMP\" + [System.IO.Path]::GetFileName($url)
    Invoke-WebRequest -Uri $url -OutFile $installer
    Start-Process -FilePath $installer -ArgumentList "/quiet /norestart" -Wait
}

When attempting to set up a local development environment with Nginx and PHP on Windows, many developers encounter this frustrating error:

The program can't start because MSVCR110.dll is missing from your computer.
Try reinstalling the program to fix this problem.

The MSVCR110.dll file is part of the Microsoft Visual C++ Redistributable for Visual Studio 2012 (VC++ 11.0). PHP binaries for Windows often require specific versions of these runtime libraries.

Common misconceptions:

  • Having other VC++ versions installed (like 2008 or 2010) doesn't help
  • The 32-bit vs 64-bit architecture must match your PHP version
  • Simple file copying won't reliably solve the issue

For PHP 5.5 (32-bit) as mentioned in the question:

  1. Download the Visual C++ Redistributable for Visual Studio 2012 Update 4
  2. Choose vcredist_x86.exe for 32-bit PHP
  3. Run the installer with administrative privileges

To verify the installation:

where MSVCR110.dll

Should return something like C:\Windows\System32\MSVCR110.dll

For advanced debugging:

# Download Dependency Walker (depends.exe)
# Run it against your php-cgi.exe
# It will show all missing DLLs in tree view

After resolving the DLL issue, ensure your nginx configuration points to the correct PHP-CGI path:

location ~ \.php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}
  • Always check PHP Windows requirements page before installation
  • Consider using phpinfo() to verify your environment
  • For new projects, consider using PHP 8.x which bundles its own VC++ runtime