0

Recently I installed XAMPP for doing local development on my Windows 7 machine. I honestly didn't think PHP was installed at all before hand. I installed the latest version of XAMPP and configured for php 5.6.24. I created some virtual hosts and everything seemed to work.

I was having an issue and I needed to confirm which version of PHP I was using so I opened up my command line and typed php -v. For some reason it is reporting I'm using PHP 5.4.25. The exact line is PHP 5.4.25 (cli) (built: Feb 5 2014 21:19:58)

I don't recall using this version (I had Visual Studio Community installed recently, is that related?). I don't understand either why my CLI is reporting one version, when XAMPP supposedly installed another version. Am I missing something? I need to run some gpm commands for the latest version of Grav CMS but when I do it says it required at least 5.5.9.

ItsPronounced
  • 5,191
  • 12
  • 40
  • 78
  • 1
    have a look at [this question](http://stackoverflow.com/questions/3057110/where-can-i-find-the-php-ini-for-php-cli) and you should be able to see where php is installed – Roshan Bhumbra Oct 21 '16 at 16:58
  • 1
    Looks like there was a PHP already installed in your server. Go to enviromen vars and take a look to PATH content, if there is a php path there then replaced it by your new PHP path (xampp) – manix Oct 21 '16 at 16:58
  • 1
    try typing `where php` to see which php exe it is pointing to. Update your Windows environment path variables to point the XAMPP bin path. – Clay Oct 21 '16 at 16:59
  • Ahhh it's pointing to an old xampp portable I had in my dropbox... – ItsPronounced Oct 21 '16 at 17:00

2 Answers2

4

It is possible to have multiple versions of php installed.

You will want to ensure that you are executing the php-cli that came with XAMPP.

It sounds like you have another version of php installed and is in your PATH so that when you run php that version is loaded.

You can use the where command to find out what file is being loaded. From the terminal type: where php

Anyways, you may want to remove that php file and possibly create a symbolic link in its place for the XAMPP version of php-cli

If you remove/rename the file and the new php-cli is not in your path, you will probably get an error as the system will not know what php is.

Community
  • 1
  • 1
Shawn Northrop
  • 5,024
  • 6
  • 35
  • 70
0

The solution to this is to uninstall all the xampp's that are installed and then fresh install xampp with php version > 7.

Everything should work fine then.

What happened to me was that I had installed xampp two times. One xampp on my C:// (version 5.6) and one xampp on my D:// (version 7.2)

When I did the command on my D:// xampp

php --version

It took the xampp php version from the C:// instead of the D://.

Mo D Genesis
  • 2,621
  • 1
  • 13
  • 25