I have a development environment based in docker.
Everytime that I open VSCode I get this message:
Cannot validate since no PHP executable is set.
Download PHP, in my case, I downloaded from here: http://windows.php.net/download/
Copy and paste the files to a location on your computer, and set the path:
"php.validate.executablePath": "C:/php/php.exe"
My case, I'm using Laragon, so you should search where is your php.exe.
By VSCode just add.
"php.executablePath": "C:\\laragon\\bin\\php\\php-7.2.19-Win32-VC15-x64\\php.exe"
on settings.json.
I had the same problem but found the fix here.
In Windows:
If you get this on windows in VS code click on the blue 'open settings' button. Near the bottom of the screen this opens there's a link to enter the settings, click this to open the settings.json file. Edit the file to look like this:
{
"php.executablePath" : "C:/php-7.4.2-nts-Win32-vc15-x64/php.exe",
"php.validate.executablePath" : "C:/php-7.4.2-nts-Win32-vc15-x64/php.exe"
}
where C:/php-7.4.2-nts-Win32-vc15-x64 is the path to your PHP dir
Sure, easy. Just follow what it's says.
Go to File> Preferences > Settings ... it will open the settings.json file.
add the following code:
{"php.validate.executablePath": "Here you put your PHP.exe path"}
You have to know where te PHP.exe file is in your computer, search in the php>bin folder.
Hope it works for you
For linux users:
if you don't have PHP installed then first download,
then in terminal type
$ whereis php
and it will show path for php executable (It will be either in /usr/bin/php
or usr/local/bin/php
) which you can copy from terminal.
In VScode goto settings.json
file and paste
php.validate.executablePath: /usr/bin/php