Why does VS Code give me the 'not recognized as an internal or external command' error?

74 Views Asked by At

I was using HTML, CSS, PHP and JavaScript to code a simple one page website in Visual Studio Code. I basically only added a background image and a header containing a logo and title when I left to do something else. When I came back, I recieved the following error:

Error spawning PHP: Command failed with exit code 1: C:/Program Files/Ampps/php --version 'C:\Program Files\Ampps\php' is not recognized as an internal or external command, operable program or batch file.

This is weird considering nothing was changed on the computer during the 15 minutes between me working on the website and getting the error.

I already tried adding the PHP path to PHP Executable Path setting as follows:

{
    "workbench.colorTheme": "Default High Contrast Light",
    "php.executablePath": "C:/Program Files/Ampps/php74",
    "php.executables": {},
    "security.workspace.trust.untrustedFiles": "open"
}

I also added the path to the environment variables, I checked my firewall permissions, updated VS Code and made sure all my extentions are up to date while restarting my PC after each attempt at removing the error message, but so far nothing has worked.

Screenshots of the latest error message and path:

Note that I tried adding both php files present in the screenshot

0

There are 0 best solutions below