include path and invalid escape character in VS code

Solution 1:

Thanks to @Andy Lin, my issue was resolved by changing the forward-slash "/" with a backslash "\": now the executable path is set in VS code.

I was facing the same issue: I downloaded PHP package but couldn't locate "php.exe", which is the main requirement in setting up the executable path in VS code.

Solution:

First, you have to copy the location where PHP downloaded package is located and copy its path, for example in my case it is "C:\Program Files\php-7.4.5"

Set Path by going into properties of This Pc > Advance System Setting > Advance > Environment Variable

A window will pop up and there will be two types of variable: - User Variable - System Variable

Edit the path and add this PHP package location in both variables and check it in CMD: it works.

Now open VS code goto Preference > Setting: there will be an error indication:

No executable file of PHP is found

Copy that PHP package location and add simply "\php.exe" in it and change backslash to forward-slash.

Now your address should look like this: "C:/Program Files/php-7.4.5/php.exe".

Paste it in VS Code Setting.

"php.validate.executablePath": "C:/Program Files/php-7.4.5/php.exe"

Finally, restart VS Code: it should work.

Solution 2:

It has to be backslash "/" instead of slash "\", however, I have no idea why is backslash.

win10, my os, uses slash for path and vscode uses backslash....