How to run multiple PHP version with XAMPP?
Try these steps:
- Stop LAMP if running.
Download libphp7.so if you don't have
https://github.com/prashant-techindustan/php7module_library/blob/master/libphp7.so
Edit /opt/lampp/etc/extra/httpd-xampp.conf (Comment out one of the following which is not needed):
LoadModule php5_module modules/libphp5.so
LoadModule php7_module modules/libphp7.so
Start LAMP
Multiple Different PHP version is not working
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
Related Topics
How to Get Count of Rows in MySQL Table Using PHP
Insert Array into MySQL Database With PHP
PHP Warning: PHP Startup: How to Load Dynamic Library
PHPdoc Type Hinting For Array of Objects
MySQLi Equivalent of MySQL_Result()
Achieve Hierarchy, Parent/Child Relationship in an Effective and Easy Way
PHP Json_Encode Encoding Numbers as Strings
SQL Injections in Adodb and General Website Security
PHP Function to Make Slug (Url String)
How to Get Protected Property of Object in PHP
How to Write a PHP Ternary Operator
How to Handle the Warning of File_Get_Contents() Function in PHP
PHP, How to Catch a Division by Zero
Is There a PHP Function Like Python'S Zip
PHP Warning: Call-Time Pass-By-Reference Has Been Deprecated