skip to Main Content

I have installed Laragon on my drive G:/Laragon . But my Visual Code is on C:/ . I dont know whether it is a root cause of the problem, but however if I change Laragon PHP version in Laragon Terminal it shows correct version, but in VC terminal it allways shows 8.1 version which I dont know from where is comming from. Does anyone knows how to solve this?

2

Answers


  1. Update your environment variable that refers to php cli inside laragon directory

    Login or Signup to reply.
  2. The Visual Studio Code’s PHP version comes from your Windows PHP version.
    so if you want to change it, you must change the PHP directory path in your windows Environment Variables.

    First Copy the path of your PHP:

    1. Go to your PHP directory where the php.exe file exists
    2. Copy the exact path from Windows Explorer like below image
      PHP version path
    3. Then go to ThisPC and Right-Click inside the white area
    4. Click Properties
    5. Click Advanced system settings
      Environment Variables
    6. Inside the new window, click the Environment Variables
      System Properties
    7. Double left-Click on path
      Environment Variables
    8. Found the old PHP path and replace your new one (if there is not any PHP path, then create one)
      Environment Variables
    9. Click on the OK buttons in all windows
    10. Close and Open again your terminals.

    Congrats! Your PHP version must be updated.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search