简体   繁体   中英

Visual Studio Code not recognize the term "php" as a command

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?

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"

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

在此处输入图像描述

Create profile

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM