6
votes

I tried to update the native php of my mba from 5.3.X to 5.4.X I did this: brew tap homebrew/dupes brew tap josegonzalez/homebrew-php brew update brew install php54

This installs php 5.4 on /usr/local/cellar/php54 now when doing which php, it gives me /usr/bin/php

I tried to add this to ~/.bashrc : export PATH=/usr/local/cellar/php54:$PATH

Now when i re-open terminal and type which php it still tells me php is located in /usr/bin/php

Is there a good way to fix this issue?

2
I found the liip PHP packages for OSX to be pretty simple to install. php-osx.liip.ch - GordonM

2 Answers

7
votes

From https://github.com/josegonzalez/homebrew-php

If you would like to swap the PHP you use on the command line, you should update the $PATH variable in either your .bashrc or .bash_profile:

# Swapping from PHP53 to PHP54
# export PATH="$(brew --prefix josegonzalez/php/php53)/bin:$PATH"
export PATH="$(brew --prefix josegonzalez/php/php54)/bin:$PATH"

Please be aware that you must make this type of change EACH time you swap between PHP minor versions. You will typically only need to update the Apache/FPM when upgrading your php patch version.

2
votes

It is usually that the path wasn't exported properly so not only php but many other brew installations might not be working, try this one:

echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile