PHP executable not found. Install PHP 7 and add it to your PATH or set the php.executablePath setting
You installed PHP IntelliSense
extension, and this error because of it.
So if you want to fix this problem go to this menu:File -> Preferences -> Settings
Now you can see 2 window. In the right window add below codes:
{
"php.validate.executablePath": "C:\\wamp64\\bin\\php\\php7.0.4\\php.exe",
"php.executablePath": "C:\\wamp64\\bin\\php\\php7.0.4\\php.exe"
}
Just like below image.
NOTICE: This address C:\\wamp64\\bin\\php\\php7.0.4\\php.exe
is my php7.exe
file address. Replace this address with own php7.exe
.
For those who are using xampp:
File -> Preferences -> Settings
"php.validate.executablePath": "C:\\xampp\\php\\php.exe",
"php.executablePath": "C:\\xampp\\php\\php.exe"
This one also works
Remove the "php.executablePath" line from the VS code settings.
Then add the xampp php path to the System variables
After that restart the Visual Studio Code
After adding php directory in User Settings,
{
"php.validate.executablePath": "C:/phpdirectory/php7.1.8/php.exe",
"php.executablePath": "C:/phpdirectory/php7.1.8/php.exe"
}
If you still have this error, please verify you have installed :
64-bit or 32-bit version of php (x64 or x86), depending on your OS;
some librairies like Visual C++ Redistributable for Visual Studio 2015 : http://www.microsoft.com/en-us/download/details.aspx?id=48145;
To test if you PHP exe is ok, open cmd.exe :
c:/prog/php-7.1.8-Win32-VC14-x64/php.exe --version
If PHP fails, a message will be prompted with the error (missing dll for example).
Try this !!!. This will solve your problem for sure!
Method 1 -
Step 1 - Go to 'Environmental Variables'.
Step 2 - Find PATH variable and add the path to your PHP folder.
Step 3 - For 'XAMPP' users put 'C:\xampp\php' and 'WAMP' users put 'C:\wamp64\bin\php\php7.1.9' ) and save.
Method 2-
In VS Code
File -> Preferences -> Settings.
Open 'settings.json' file and put the below codes.
If you are using WAMP put this code and Save.
"php.validate.executablePath": "C:\\wamp64\\bin\\php\\php7.1.9\\php.exe",
"php.executablePath": "C:\\wamp64\\bin\\php\\php7.1.9\\php.exe"
If you are using XAMPP put this code and Save.
"php.validate.executablePath": "C:\\xampp\\php\\php.exe",
"php.executablePath": "C:\\xampp\\php\\php.exe"
Note - Replace php7.1.9 with your PHP version.