PHP on Windows: workaround for a command-line error (MSVCR71.DLL is missing)


I’m currently writing a tutorial on how to install, test and use the PHP symfony framework on Windows Web Server 2008.

In order to install it, I start from a raw Windows Server installation, with IIS role not enabled.

I download Microsoft Web Platform Installer (WebPI) 2.0 RTM from this link, and only select PHP 5.2.11.

WebPI selects all dependencies, and install goes fine.

Execution of phpinfo.php I created in C:\inetup\wwwroot is fine.

But…

When I open a command prompt, CD to \inetpub\wwwroot, type “PHP phpinfo.php”, and get the blocking error:

This application has failed to start because MSVCR71.dll was not found. Re-installing the application may fix the problem.

See picture:     Figure 4.1 - PHP - MSVCR71.DLL not found

If we don’t do anything, the execution of PHP.EXE hangs on the absence of MSVCR71.DLL. It’s annoying, as all symfony commands rely on PHP.EXE command line. So we must find that DLL file, and install it at the correct place.

This MSVCR71.DLL is an old version of the Microsoft Visual C++ runtime, dated back to the 2003 era. It is contained in the .Net Framework 1.1 redistributable package.

To download the .Net Framework 1.1 redistributable package, just go to:
<http://msdn.microsoft.com/fr-fr/netframework/aa569263.aspx>

After install, the file we’re looking for is installed in the following directory :
C:\Windows\Microsoft.NET\Framework\v1.1.4322

Just copy the MSVCR71.DLL to the following destination:
-on x64 systems: in C:\windows\syswow64 directory;
-on x86 systems: in C:\windows\system32 directory,

You now can uninstall the .Net Framework 1.1.

Then, we can run PHP.EXE from the command prompt without error.

Useful?


Comments (5)

  1. boutell says:

    Hi, I read your tutorial today:

    http://www.symfony-project.org/more-with-symfony/1_4/en/11-Windows-and-Symfony

    The screenshots were useful, thank you.

    Unfortunately there is a security hole in your recommended setup. Adding /web to every URL as you suggest and making the project root the web root exposes the config/databases.yml file to snooping by anyone who cares to look. And of course it’s not an elegant URL. But the security issue is a bigger problem.

    I wrote an article today which describes the setup I arrived at and covers how to avoid that security problem. I would strongly recommend editing your article to avoid the issue in question:

    http://window.punkave.com/2010/04/26/faster-windows-php-kill-kill/

    Thanks!

  2. georg says:

    Very useful since Im trying to install Apache with PHP, which I did successfully back in 05;

    however "PROGRESS" have been ongoing and everything shall be more complex; so when running PHP.exe the MSVCR71.dll is COMPLINED on (I just now dont know is that is also the problem why Apache wont work when PHP is addedd). NOW your reference to pic up framework for 1.1 is no longer valid

    back in 05 there were no external .dll dependency for PHP, regrettable when people are building spagetti

  3. JB says:

    Many thanks. Already spent hours troubleshooting this. I skipped Windows Update after a server rebuild so was missing Framework 1.1 and had the mssql error.

    Thanks again.

  4. Tao says:

    Very useful. I lost much time to find that.