drpcken drpcken - 1 year ago 40
PHP Question

PHP (cli) version doesn't match XAMPP version I installed

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.

Answer Source

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.