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?
Before you can enable PHP on a Mac, you first have to enable Apache. Both PHP and Apache are free open source software programs and both come installed on all Macs. PHP is server-side software, and Apache is the most widely used web server software. Enabling Apache and PHP on a Mac isn't difficult to do.
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.
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
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