22

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 ?

Robert Brax
  • 6,508
  • 12
  • 40
  • 69
  • 6
    Did you try `which php` ? – mim. Nov 21 '16 at 18:36
  • /usr/bin/php but I think this is the 5.X php version. The 7 is installed trough mamp and vscode needs 7 – Robert Brax Nov 21 '16 at 18:40
  • 4
    That is the correct settings and I confirmed it works on my machine with VSCode 1.7.2. What happens if you run `$ /Applications/MAMP/bin/php/php7.0.12/bin/php --version` from the command line? – Matt Bierner Nov 29 '16 at 01:53

2 Answers2

31

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

Alexander Wigmore
  • 3,157
  • 4
  • 38
  • 60
Jonathan Nicol
  • 3,158
  • 1
  • 21
  • 22
21

I am using mac i have install php intellisense that required php version 7 executable path i have already php 7 installed. Terminal command

which php

work for me.

Abdul Manan
  • 2,255
  • 3
  • 27
  • 51