skip to Main Content

In my Windows terminal (cmd), the php -v command return the version of installed PHP in my computer. But when I type it at Visual Studio Code (version 1.63.2) terminal, it gives me the error below:

php : The term ‘php’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • php -v
  • + CategoryInfo          : ObjectNotFound: (php:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
    

Note that the environment variable is already set.
Any idea please ?

2

Answers


  1. Chosen as BEST ANSWER

    Actually, I solved the problem by deleting (killing) the already created profile in the VSC terminal (see the below figure) and adding a new one. Restarting VSC is not enough. You have to delete or kill the terminal profile and re-create it again by choosing PowerShell or command prompt or whatever you want according to your system.

    Delete profile

    enter image description here

    Create profile

    enter image description here


  2. VSC is running powershell as terminal, configure it to use CMD
    in your user’s file->preferences->settings add:

    "terminal.integrated.shell.windows":"cmd.exe"
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search