174

I have an error when I start PHP 7 on Windows. When I run php on the command line, it returns a message box with system error:

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

After that, CLI is crashing.

As I don't want to install a DLL file from an external website, I don't know how to fix this!

PHP version: 7.0.0alpha1 VC14 x64 Thread Safe

Merlin04
  • 1,837
  • 4
  • 23
  • 27
Félix Desjardins
  • 3,223
  • 3
  • 21
  • 36
  • 8
    Nominating for reopen on this basis: "they directly involve tools used primarily for programming". Which is true of this question. – Adam Cameron Jun 13 '15 at 19:30
  • even same problem with me mine is VC6 x84 but unable to install wampserver. i have searched all over google . Kindly help me . – Pavan Baddi Jan 22 '17 at 05:45
  • @Pavan Baddi - I had troubles too with certain VC versions not working with my WAMP. Installed Visual C++ Redistributable for Visual Studio 2012 x64 and x86 (run with admin privileges) alongside Wampserver x64 3.0.6 and it works now. – user1228907 Feb 28 '17 at 22:28
  • The solution here: https://stackoverflow.com/questions/34482393/vcruntime140-dll-missing fix it for me – Angel115 Oct 10 '17 at 20:07

9 Answers9

234

On the side bar of the PHP 7 alpha download page, it does say this:

VC9, VC11 & VC14 More recent versions of PHP are built with VC9, VC11 or VC14 (Visual Studio 2008, 2012 or 2015 compiler respectively) and include improvements in performance and stability.

  • The VC9 builds require you to have the Visual C++ Redistributable for Visual Studio 2008 SP1 x86 or x64 installed

  • The VC11 builds require to have the Visual C++ Redistributable for Visual Studio 2012 x86 or x64 installed

  • The VC14 builds require to have the Visual C++ Redistributable for Visual Studio 2015 x86 or x64 installed

There's been a problem with some of those links, so the files are also available from Softpedia.

In the case of the PHP 7 alpha, it's the last option that's required.

I think that the placement of this information is poor, as it's kind of marginalized (i.e.: it's basically literally in the margin!) whereas it's actually critical for the software to run.

I documented my experiences of getting PHP 7 alpha up and running on Windows 8.1 in PHP: getting PHP7 alpha running on Windows 8.1, and it covers some more symptoms that might crop up. They're out of scope for this question but might help other people.

Other symptom of this issue:

  • Apache not starting, claiming php7apache2_4.dll is missing despite it definitely being in place, and offering nothing else in any log.
  • php-cgi.exe - The FastCGI process exited unexpectedly (as per @ftexperts's comment below)

Attempted solution:

  • Using the php7apache2_4.dll file from an earlier PHP 7 dev build. This did not work.

(I include those for googleability.)

Palec
  • 12,743
  • 8
  • 69
  • 138
Adam Cameron
  • 29,677
  • 4
  • 37
  • 78
  • Another symptom in IIS7: "php-cgi.exe - The FastCGI process exited unexpectedly" – ftexperts Jan 11 '16 at 04:09
  • None of the microsoft.com download links work for me (gateway timeout error). Alternative mirrors are here: http://www.softpedia.com/get/Programming/Components-Libraries/Microsoft-Visual-C-Redistributable-Package.shtml#download – rybo111 Mar 31 '16 at 14:14
  • @rybo111I think it was transient or problem on your end? They're OK for me (didn't check all of them). But I reckon I'll add your link as an alternative to the answer though! Cheers. – Adam Cameron Mar 31 '16 at 15:46
  • I install almost every version but getting the same error VCRUNTIME140.dll when I install version of 2015 Update RC 2 .dll error get away , may help someone else – Naveed Apr 13 '16 at 16:41
  • The dam **sidebar** with all the important information is one of the most powerful examples of usability fails I've ever seen. – Pacerier Apr 15 '16 at 12:39
  • I have installed VC 2015, update 1, update 2 and this didn't solve the problem. Still having 'VCRUNTIME140.dll is missing' error. – Esamo May 15 '16 at 20:10
  • Not with PHP 7 but with some other VC runtime-using app I had... I had a conflict between one of my already-existing runtimes and the one the app was supposed to be looking for. I cannot remember the details but I needed to deinstall some existing ones and reinstall just the more recent ones. It's not something I need to look at very often, sorry to sound vague. – Adam Cameron May 17 '16 at 09:18
  • 1
    current download link https://www.microsoft.com/en-us/download/details.aspx?id=52685 – mdo123 Jun 05 '17 at 20:23
  • Installed Visual C++ Redistributable for Visual Studio 2015 on my Windows Server and PHP works fine as f now! Thank you! <3 – Osama Ibrahim Sep 03 '19 at 13:26
  • i fould the solution [here](https://stackoverflow.com/a/59414266/14629458) – Yasser CHENIK Mar 08 '22 at 14:00
25

Visual C++ Redistributable for Visual Studio 2015 (x32 bit version) - RC.

This should correct that. You can google for what the DLL is, but that's not important.

PS: It's officially from Microsoft too:)

Where I found it: Downloads (Visual Studio)

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Thomas
  • 1,401
  • 8
  • 12
18

Installing vc_redist.x86.exe works for me even though you have a 64-bit machine.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Prakash N
  • 210
  • 2
  • 10
14

If you've followed Adam's instructions and you're still getting this error make sure you've installed the right variants (x86 or x64).

I had VC14x64 with PHP7x86 and I still got this error. Changing PHP7 to x64 fixed it. It's easy to miss you accidentally installed the wrong version.

Halcyon
  • 57,230
  • 10
  • 89
  • 128
11

For things like this, you don't blindly keep clicking 'Next', 'Next', and 'I Agree'.

WAMP informs you about this during and before installation:

The MSVC runtime libraries VC9, VC10, VC11 are required for Wampserver 2.4, 2.5 and 3.0, even if you use only Apache and PHP versions with VC11. Runtimes VC13, VC14 is required for PHP 7 and Apache 2.4.17

VC9 Packages (Visual C++ 2008 SP1) http://www.microsoft.com/en-us/download/details.aspx?id=5582 http://www.microsoft.com/en-us/download/details.aspx?id=2092

VC10 Packages (Visual C++ 2010 SP1) http://www.microsoft.com/en-us/download/details.aspx?id=8328 http://www.microsoft.com/en-us/download/details.aspx?id=13523

VC11 Packages (Visual C++ 2012 Update 4) The two files VSU4\vcredist_x86.exe and VSU4\vcredist_x64.exe to be download are on the same page: http://www.microsoft.com/en-us/download/details.aspx?id=30679

VC13 Packages] (Visual C++ 2013[) The two files VSU4\vcredist_x86.exe and VSU4\vcredist_x64.exe to be download are on the same page: https://www.microsoft.com/en-us/download/details.aspx?id=40784

VC14 Packages (Visual C++ 2015) The two files vcredist_x86.exe and vcredist_x64.exe to be download are on the same page: http://www.microsoft.com/en-us/download/details.aspx?id=48145

You must install both 32 and 64bit versions, even if you do not use Wampserver 64 bit.

IMPORTANT NOTE: Be sure to to run all Microsoft Visual C++ installations with administrator privileges (right click → Run as Administrator). Just missing this small step wasted my entire day.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ikhlak S.
  • 8,578
  • 10
  • 57
  • 77
  • 1
    I can't edit your post but for wamp users, can refer to this http://wampserver.aviatechno.net/ There is a check tool to validate if all VC packages are installed. Additional to the packages mentioned by @user3284463, must be installed Visual C++ 2008 SP1 ATL Security Update Redist. Package and Visual C++ 2008 SP1 MFC Security Update Redist. Package. All information needed is in the link above. – georgeos Apr 06 '17 at 18:30
3

I had same problem when installing Robot Framework 2.9.2 using the Windows installer version on Windows 7.

I could solve it installing the VC14 builds require to have the "Visual C++ Redistributable for Visual Studio 2015 x86 or x64 installed" from Microsoft website.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Maq Said
  • 55
  • 1
  • 4
  • 8
1

I got same error and found that my Microsoft Visual C++ is 32 bit and Windows is 64 bit. I tried to install WAMP 7 32 bit and the problem was solved.

Maybe we need to install WAMP 32 bit if Visual Studio is 32 bit. And vice versa.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

I had the same issue, I changed the ports, restarted the services but in vein, only worked for me when I updated the Microsoft Visual c++ filesFrom There yoy can modify MVC

-4

Usually this is an error in your PHP configuration.

It's actually pretty easy to figure out what exactly is going on:

  • Create a small file (test.php) with the standard phpinfo() script
  • Open a command prompt
  • Start php manually using the small file, e.g. '"\program files\php\php.exe" test.php
  • Read the error messages :-)
atlaste
  • 30,418
  • 3
  • 57
  • 87