Home > Software design >  Visual Studio Code not recognize the term "php" as a command
Visual Studio Code not recognize the term "php" as a command

Time:01-27

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 ?

CodePudding user response:

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"

CodePudding user response:

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

  •  Tags:  
  • Related