PHP version in CLI is wrong even if PATH is right

  • | 2489 points

    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! :-O

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

  • administrators
    | 131219 points

    @ivanhalen : Did you switch to PHP 7.1.12 (click Menu > PHP > Version > xxx)?

  • | 2489 points

    Yes, I did at first...
    Anyway, after a couple of opening/closing Terminal and restart Windows, it worked :-)

  • | 139 points

    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.

  • | 19 points

    Solution: Completely exit Laragon and restart it, it will fix this issue.

  • | 188 points

    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

  • | 9 points

    I have try above solution but not work.

  • | 248 points

    @ivanhalen I found that my Windows System Path had the path to the old version of PHP listed, whereas the User Path had all the Laragon paths including the new one to the upgraded version of PHP. Deleting the Windows System old path and restarting Windows resolved this for me. Hope this helps someone else searching for this.

Log in to reply

Looks like your connection to Laragon was lost, please wait while we try to reconnect.