PHP version in CLI is wrong even if PATH is right
I have latest Laragon installed and I added both PHP 5.6.33 and 7.1.12
With the 7.1.12 version active, I added Laragon to PATH, and indedd I can see my 7.12 version in the PATH's list.
I also restarted a couple of time as suggested by Laragon to be sure.
But when I type "php -v" (no quotes) in a cmd shell, I get the PHP 5.6.33 version, and this prevents me form installing latest Laravel release
Even if I remove Laragon from PATH (and restart), so that I have no PHP version in PATH, the "php -v" command still tells me that 5.6.33 is there: and I have no idea where it comes from!
Only when I delete the 5.6.33 folder, restart and add Laragon to PATH, then the right 7.1.12 is in my CLI; but soon as I restore the 5.6.33 folder, the CLI is back to 5.6.33 version... and this is driving me mad!
Any idea, please?
EDIT: wait, there's more! If I type "php -v" from the classic cmd windows, I get the right 7.1.12 version! But when I use the bundled Terminal in Laragon I get the 5.6.33 version...
@ivanhalen : Did you switch to PHP 7.1.12 (click Menu > PHP > Version > xxx)?
Yes, I did at first...
Anyway, after a couple of opening/closing Terminal and restart Windows, it worked
We got the same problem with laragon on different computers. When switching PHP version, the CLI version stays on 7.xx even after opening/closing cmder a few times... Perhaps restarting Windows fixes the problem but it doesn't seems to be a valid solution.
Solution: Completely exit Laragon and restart it, it will fix this issue.
Restarting Laragon helped with having the new php version in the "Laragon" terminal, but PowerShell still had the old version. The problem seemed to be with the Windows PATH - it didn't have a direct reference to the new PHP version. I fixed it by reading Laragon to PATH with:
Menu > Tools > Path > Add Laragon to Path
I have try above solution but not work.