/    Sign up×
Bounties /Pin to ProfileBookmark

VS Code “Cannot validate since a PHP installation could not be found.”

I’m currently using Visual Studio Code version 1.71.0 and an error I’ve been seeing for awhile with PHP files is:

Cannot validate since a PHP installation could not be found. Use the setting ‘php.validate.executablePath’ to configure the PHP executable.

What is the quick fix to get this to go away?

to post a answer
EngineerPHP

1 Replies

Copy linkTweet thisAlerts:
@samontabSep 13.2022 — This means that VS Code cannot find the PHP executable. You can make it go away by simply setting the PHP executable path in the settings.

To do that, in VS Code go to File->Preferences->Settings and search for PHP. You'll see something similar to this:



Click on Edit in settings.json.

An editable file will open. Simply put the path of the PHP executable there and save the file:

"php.validate.executablePath": "/path/to/php"

The path of PHP will depend on your specific environment.

It's also possible that you don't have installed the command line PHP executable. If that's the case, you can install PHP following the official documentation.

If you don't know where PHP is, on MacOS and Linux systems you can use which to get the path of the executable, like this:
which php
That should give you the path of PHP. Simply put that in the settings file and the error should go away.
@samontabThere's also the option to simply ignore it by adding the following to settings.json: "php.validate.enable": falseSep 13.2022
@buildinteractiveauthorThank you for the thorough answer!Sep 14.2022
×

Success!

Help @buildinteractive spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 11.30,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @bahaedd,
tipped: article
amount: 1000 SATS,

tipper: @Balmasexy,
tipped: article
amount: 1000 SATS,

tipper: @mbsaad,
tipped: article
amount: 1000 SATS,
)...