PHP (cli) version not updating


  • | 858 points

    I have been using Laragon for quite a while and have several versions of PHP installed which I switch between for different projects.

    This morning I'm unable to 'fully' switch between PHP versions. I can select any installed version (and the corresponding Apache) via the Laragon GUI, but the cli version doesn't change. PHP -v always reports that it is running PHP 8.0.13 (cli). This means that any Composer updates/installs fail with a message like "- Root composer.json requires php ^8.1.0 but your php version (8.0.13) does not satisfy that requirement." - even though I've switched to PHP 8.1 in Laragon.

    Very frustrating! Has anybody else experienced this/know how to resolve?

    Edit: I've tried Menu > Tools > PATH environment variable > Add Laragon to Path as per this thread: https://forum.laragon.org/topic/166/tutorial-how-to-add-another-php-version-php-7-4-php-8-0-updated/87?page=5 but it hasn't made any difference.

    Edit 2: Renaming the php-8.0.13-Win32-vs16-x64 folder in C:\Laragon\bin\php has allowed me to switch to PHP version 8.1... but now PHP CLI is stuck on this version regardless of which version I choose in the Laragon GUI.


  • administrators
    | 135161 points

    @sng82 Please check your PATH to see if there is any other PHP installed globally by accident.


  • | 858 points

    Hi @leokhoa,

    Thanks for the suggestion.

    Do you mean to check what's in Menu > Tools > Path > Manage Path? The below is what I see here (having forced Laragon to use PHP v 8.1 as per edit two above.). I'm not really sure what I'm looking for, but It doesn't look like PHP is installed anywhere else to me?:

    --------------- Laragon ---------------
    ;
    C:\laragon\bin;
    C:\laragon\bin\apache\httpd-2.4.47-win64-VS16\bin;
    C:\laragon\bin\composer;
    C:\laragon\bin\git\bin;
    C:\laragon\bin\git\cmd;
    C:\laragon\bin\git\mingw64\bin;
    C:\laragon\bin\git\usr\bin;
    C:\laragon\bin\laragon\utils;
    C:\laragon\bin\mysql\mysql-5.7.33-winx64\bin;
    C:\laragon\bin\nginx\nginx-1.19.10;
    C:\laragon\bin\ngrok;
    C:\laragon\bin\nodejs\node-v14;
    C:\laragon\bin\notepad++;
    C:\laragon\bin\php\php-8.1.9-Win32-vs16-x64;
    C:\laragon\bin\redis\redis-x64-3.2.100;
    C:\laragon\bin\telnet;
    C:\laragon\usr\bin;
    C:\Users\[my username]\AppData\Local\Yarn\config\global\node_modules\.bin;
    C:\Users\[my username]\AppData\Roaming\Composer\vendor\bin;
    C:\Users\[my username]\AppData\Roaming\npm;
    
    --------------- User ---------------
    C:\laragon\bin;
    C:\laragon\bin\apache\httpd-2.4.47-win64-VS16\bin;
    C:\laragon\bin\composer;
    C:\laragon\bin\git\bin;
    C:\laragon\bin\git\cmd;
    C:\laragon\bin\git\mingw64\bin;
    C:\laragon\bin\git\usr\bin;
    C:\laragon\bin\laragon\utils;
    C:\laragon\bin\mysql\mysql-5.7.33-winx64\bin;
    C:\laragon\bin\nginx\nginx-1.19.10;
    C:\laragon\bin\ngrok;
    C:\laragon\bin\nodejs\node-v14;
    C:\laragon\bin\notepad++;
    C:\laragon\bin\php\php-8.1.9-Win32-vs16-x64;
    C:\laragon\bin\redis\redis-x64-3.2.100;
    C:\laragon\bin\telnet;
    C:\laragon\usr\bin;
    C:\Users\[my username]\AppData\Local\Yarn\config\global\node_modules\.bin;
    C:\Users\[my username]\AppData\Roaming\Composer\vendor\bin;
    C:\Users\[my username]\AppData\Roaming\npm;
    C:\Users\[my username]\AppData\Local\Microsoft\WindowsApps;
    C:\Users\[my username]\AppData\Local\Programs\Microsoft VS Code\bin;
    C:\Users\[my username]\AppData\Local\JetBrains\Toolbox\scripts
    
    --------------- System ---------------
    C:\Python39\Scripts\;
    C:\Python39\;
    %SystemRoot%\system32;
    %SystemRoot%;
    %SystemRoot%\System32\Wbem;
    %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
    %SYSTEMROOT%\System32\OpenSSH\;
    C:\Program Files\nodejs\;
    C:\ProgramData\chocolatey\bin;
    C:\ProgramData\ComposerSetup\bin;
    C:\Program Files\PuTTY\;
    C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;
    C:\laragon\bin\php\php-8.0.13-Win32-vs16-x64;
    C:\Program Files\Git\cmd
    
    

  • | 37234 points

    @sng82 said in PHP (cli) version not updating:

    C:\laragon\bin\php\php-8.0.13-Win32-vs16-x64;

    Yes, You have PHP 8.0.13 under system

    • Click your windows start button and type advanced system
    • choose Environment Variables...
    • Under System variables click Path (not User variables)
    • Click Edit... button
    • Click the line with C:\laragon\bin\php\php-8.0.13-Win32-vs16-x64;
    • make sure only that line is highlighted and click the delete button
    • OK out of all the windows and log off and back on.

    0_1663000480569_upload-65dfac63-e25f-4170-b775-6d4f3e638cc7


  • | 858 points

    Thanks @Pen-y-Fan, your guide is perfect! Everything seems to be working as expected now.


Log in to reply
 

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