4

I installed the PHP Intellisense extension and followed the instructions to point VSCode to my php file, I also setup the environmental; variable in windows to point to the php directory.

When I open VSCode I get the following error:

PHP executable not found. You need PHP 7 installed and in your PATH

VSCode Settings:

enter image description here

Environmental Variables:

enter image description here

How can I get this to work?

I have referred to:

Community
  • 1
  • 1
Douglas Gaskell
  • 9,017
  • 9
  • 71
  • 128

3 Answers3

1

You need to click on "Path" and highlight it in the list of System variables and then click the Edit button. A new window with a list of paths in the environmental variable will open. Click the New button on the top right and type or paste your copied path to PHP.exe there. It should work then.

Jason Hanson
  • 321
  • 3
  • 3
1

You have to append php path to the Path variable.
Click on "Path" select edit
click the red color marked item
Do not modify the values, just insert semicolon(;) to the end of the values, then paste(append) "C:\xampp\php" to end of the Path value
Then save settings. You may need to restart your machine

kavinda
  • 628
  • 1
  • 9
  • 14
0

I faced same issue, I did exactly as your case but still got the error, the below solution worked for me.

I had changed the .EXE PHP file to: php-win.exe and that's it, the VS settings should like that (according to my path):

"php.validate.executablePath": "D:\\Program Files (x86)\\PHP\\php\\php-win.exe",
"php.executablePath": "D:\\Program Files (x86)\\PHP\\php\\php-win.exe"

VS PHP Path

Don't Panic
  • 13,965
  • 5
  • 32
  • 51
Al1
  • 308
  • 3
  • 9