
How you can fix this:
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:
1) Get to settings:
Method 1:
- Click the button that says settings on the error (bottom right corner of the error)

Method 2:
- Click the shortcut for settings (ctrl + ,) ( if doesn't work resort to method 3 or 4 )
Method 3:
file
> preferences
> settings
Method 4:
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.
2) Get to JSON
file to resolve error:
Method 1:
- Click the underlined text that says edit in
settings.json
(it should be right in front of you nearly in the centre of the screen)
Method 2:
- Click the
{}
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)

3) Enter this code:
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)
4) Now save and close Visual Studio Code and re-open it
I hoped this helped if not I am sorry but this worked for me after looking around for a bit.