Guybrush Guybrush -4 years ago 61
PHP Question

How to get Mac's terminal to use Brew's PHP version?

I'm currently trying to get PHP 7.1 on my mac. I followed this guide and successfully installed and linked php71 https://developerjack.com/blog/2016/08/26/Installing-PHP71-with-homebrew/

However, when running php -v from the terminal (after restarting computer, after running source bashprofile etc.), I still get PHP 5.6.30 (cli). Is there a way to get the terminal to use brews install instead of the version that comes with mac?

Answer Source

Various ways:

  • make a softlink from your php location to /usr/local/bin e.g. ln -s /usr/local/Cellar/php /usr/local/bin/php and make sure /usr/local/bin is before /usr/bin in your path variable.
  • make an alias is .bash_profile (restart your terminal) alias php = /yourpath
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download