First, go to File->Preferences->User settings, A window will come like below image.
Now change the setting.json file like below image and save:
If PHP is not installed in your system, download php from here: windows.php.net/download, unzip to C:
drive, set "php.validate.executablePath": "C://path.to.your.php.folder//php.exe"
If php is installed in your system simply set the path of your php.exe
file like below:
"php.validate.executablePath": "C://path.to.your.php.folder//php.exe"
hint: In my case I use XAMPP which is installed in the D: drive, so my setting is below
"php.validate.executablePath": "D://xampp//php//php.exe"
Mind the double forward slashes.
I solved it by adding lines
"php.executablePath": "C:/wamp64/bin/php/php7.1.9/php.exe",
"php.validate.executablePath": "C:/wamp64/bin/php/php7.1.9/php.exe"
Perhaps it is a syntaxis issue. After many tries I found that the command had to be written
"php.validate.executablePath": "C:\\xampp\\php\\php.exe",
(with 2 backslashes). I noticed that many answers said that a normal slash (/) or just one back slash worked as well. I have the Visual Studio Code version 1.17.0-insider x64.
The solution worked independently of the location of the executable file. Which in my case was located in C:\xampp\php\php.exe and C:\Program Files\PHP\v7.1\php.exe.
If you have installed xampp
for making a localhost database this is for if your new to php
and are getting the error in the picture and this is how to fix it. I am using visual studio code.
How to get rid of error:
Method 1:
Method 2:
Method 3:
file
> preferences
> settings
file (top left next to icon of visual studio code) image of where to click method 3,1
preferences (near bottom under auto save) image of where to click method 3,2
settings (the very top option) image of where to click method 3,3
Method 4:
Click cog icon (bottom left under the account icon/person) image of where to click method 4,1
Settings (second option from top) image of where to click method 4,2
Now you should be in settings and it should look like this:
UNLESS you did method 1 in how to get to settings, And you clicked on the button that said settings on the error message, I cannot include anymore pictures, read carefully.
JSON
file to resolve error:Method 1:
settings.json
(it should be right in front of you nearly in the centre of the screen)Method 2:
{}
or paper with the arrow suggesting turning over the paper, When hovering over it, it will say open settings (JSON)
(you will find it under the minimize screen button in the top right corner of the screen)Method 1:
You should be using xampp
because this tutorial is for that specific control panel.
Inside the main JSON
brackets ({}
)
Add this to the end:
{
"php.validate.executablePath": "C:/xampp/php/php.exe"
}
Method 2:
If using a different drive simply change the C:
to whatever drive it is e.g. D:
If still getting the error change the path so it works for you, you want to locate the php.exe
or just PHP
and the file class will be "application"
,
Then route the exe to the PHP
using the path you took to locate the php.exe
"application"
Remember you start at your drive so it should always start with C:
(the drive you saved the xampp
in)
I hoped this helped if not I am sorry but this worked for me after looking around for a bit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With