K Cowles
K Cowles

Reputation: 23

wrong php version in visual studio code

I installed Visual Code Studio w/ESLint. It won't operate because it is reporting "Language server needs at least PHP 7 installed. Version found: 5.5.38". After researching, I discovered that it seems to be looking at the pre-installed MAC OSX php version. I downloaded and ran PHP 7.1 onto the Mac, changed the PATH variables in ~/.profile, as recommended. I made sure that the LoadModule php5_module ... line in /etc/apache2/httpd.conf was commented out, and restarted (reboot of machine). When I do: > php -v it yields the new version (7.1), but the error report from VSC is the same. What am I missing?

Upvotes: 0

Views: 9824

Answers (1)

Kirkland
Kirkland

Reputation: 843

I'm not necessarily sure what you're missing, but I'd use Homebrew, then once installed type the following into terminal to install php 7.1

brew install homebrew/php/php71

You can use the following to switch between versions:

brew unlink php71

And then to link (and vice versa):

brew link php55

To get the version of the PHP that is currently in PATH, type

php --version

Trust me, I've been doing LAMP development for seven years and it's a pain to not use Homebrew if you're using a Mac. I've also used VS Code before I started using PHP Storm, and this method worked for me.

Upvotes: 2

Related Questions