2

In my system I have 2 xampp servers installed.

In one xampp server php version is 5.6 and second xampp server php version is 7.3 .

In both server paths, only php 5.6 version is shown at command line.
Supported 7.3 is not working.
In both server path php 5.6 displayed.

So when I use Composer and Laravel always fetch php 5.6.

Please help me to solve this problem..

https://i.sstatic.net/ywNZa.png

4
  • 1
    Changing PHP version on xampp does not affect on php cli version. You have to change php path on PATH. Commented Feb 27, 2021 at 4:20
  • you can use this link to change path variable of your system Commented Feb 27, 2021 at 4:52
  • @Maitrik can you say if my answer solved you problem? Commented Feb 28, 2021 at 21:36
  • @Luiz Vaz, at one time two environment variable is not working, either work PHP 7 variable else PHP 5 working. Commented Mar 1, 2021 at 8:42

1 Answer 1

1

You are trying to run the CLI version of PHP.
So it's all about your PATH variable.

Windows looks for paths in PATH variable to know where are executables.

By the way, the php.exe it's inside c:\xampp\php directory. And, the 7.3 would be inside c:\xampp_7.3\php directory.

And of course, the PATH variable has something like PATH=c:\xampp\php;...
That's why 5.6 version is always picked.

Run command c:\set PATH and will show your settings like:

Path=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Python38\Script
s\;C:\Python38\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windo
ws\System32\WindowsPowerShell\v1.0\;C:\xampp\php;...

To work, with changing PATH variable you need to move to you path where is composer.phar and composer.json and run:

c:\> cd \composer\file\
c:\composer\file> \xampp_7.3\php\php.exe composer.phar install

More information here: How to determine path to php.exe on Windows - search default paths

UPDATE:

As an alternative, you can set two environment variables and use them like below:

c:\> set PHP56="c:\xampp\php\php.exe"
c:\> set PHP73="c:\xampp_7.3\php\php.exe"

c:\> %PHP56% -v
PHP 5.6.40 (cli) (built: Jul  2 2019 15:10:36) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

c:\> %PHP73% -v
PHP 7.3.10 (cli) (built: Jul  2 2019 13:01:33) 
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.