vscode requires path to php set for this parameter:
"php.validate.executablePath":
so I specified this:
"/Applications/MAMP/bin/php/php7.0.12/bin/php"
but it isn't recognized.
What is the correct path ?
On a Linux or Mac OS X system, this may be available as the file /usr/bin/php. If you've installed XAMPP, you can use the program /opt/lampp/bin/php on Linux, /Applications/xampp/xamppfiles/bin/php on Mac OS X, and C:\Program Files\xampp\php\php.exe on Windows.
From below example, we can see the PHP executable file path is /usr/bin/php , and it is linked to /www/server/php/73/bin/php file ( this is the real PHP executable file ). If whereis command returns multiple PHP install path, then you can run which command to get current PHP executable file path.
1) Open visual studio code, by pressing Cmd+space type visual studio code and press enter. 2) Click on the extension button and in the search bar type PHP Debug , select the first option from Felix Becker and click on the small blue install button.
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 Sure, easy. Just follow what it's says. Go to File> Preferences > Settings ... it will open the settings.json file.
For macOS users, you can install the Xdebug extension for your version of PHP using Homebrew. They recommend using PECL to install it. Another option is to compile the source code and then install. PEAR/PECL is PHP's Package Repository for easy download and installation of Xdebug and also other tools.
In Windows: 1 Go To System Properties 2 Go To Advanced Tab 3 Click "Environment Variables" 4 Select Path 5 Add a new path that points to your php 7 executable:
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 Show activity on this post. Sure, easy. Just follow what it's says. Go to File> Preferences > Settings ... it will open the settings.json file.
I ran into this problem after installing the PHP Intellisense extension in vscode. For Intellisense to work I needed to point vscode at MAMP's version of PHP, not the default OS X version of PHP, but it did not recognise the path I was specifying.
I was able to resolve the issue by specifying the "php.executablePath"
preference instead of "php.validate.executablePath"
.
"php.executablePath": "/Applications/MAMP/bin/php/php7.4.21/bin/php"
Here is an explanation from the author of the package:
validate has nothing to do with this extension, but is the built-in validation of VS Code. I would disable that, because you will get duplicate validation. php.executablePath should be set to the path of the binary
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