0

I have installed two xampp in my windows 11 machine. One is in c:/xampp and another one is in E:/xampp but the environment variable that I have been using is taking the php version from E:/xampp/php. I would like to run lower version of laravel application with older php version 7 in C:/xampp and new laravel development I would like to use the E:/xampp with latest php version 8. Is there a way in which The xampp in C can use only the php from c:/xampp and the xampp in E can only use the php from E:/xampp.

jeenus
  • 1
  • 2
    Does this answer your question? [Is there way to use two PHP versions in XAMPP?](https://stackoverflow.com/questions/45790160/is-there-way-to-use-two-php-versions-in-xampp) – SEYED BABAK ASHRAFI Jan 05 '22 at 13:48
  • Quick fast solution for me was to keep Environment path same, i just switch content in php folder – Nebojsa Nebojsa Jan 05 '22 at 14:07
  • @BABAKASHRAFI in laravel the composer will not identify the php version we are mentioning in the composer.json. It won't work even if the single xampp has multiple php in it. I have set up my second xampp according to the link you have mentioned. but it is not working. – jeenus Jan 05 '22 at 14:13
  • @NebojsaNebojsa As you have mentioned about environment variable. i checked with 'where php' command in my terminal and it clearly took the php version from the xampp i have installed in my E:/ drive. So i set another environment variable there and set the php path to C:/ drive xampp. So now there are two environment vars when i run the 'where php' in terminal. But still my laravel app composer update uses the php 8 from the E:/xampp/php. But in my C:/xampp/php i have the php version 7 which i want to use to avoid the php error: 'getClass() is deprecated' . – jeenus Jan 05 '22 at 14:19
  • @jeenus I keep the only one ENV path for php, which point to one `php` directory, and only one xampp, just replace whole php folder content with another content (cut/paste work to remove one version and place another). and that was quickies way to switch php versions with one xampp – Nebojsa Nebojsa Jan 05 '22 at 15:13

2 Answers2

0

Best way is to make virtual host and defile both project paths in virtual host. like abc.com for a project in C directory project and xyz.com for E directory project. in this way you will run xamp that will automatically map project for its url defined in virtual host configurations.

you can get proper guideline from here in this link:

0

With Deverser and his Virtual Host Manager you can do whatever you want. You can define a specific environment for each one.

Peter Estiven
  • 414
  • 1
  • 7
  • 16