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..
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