rosscooper rosscooper - 1 year ago 100
PHP Question

OSX El Capitan Permanently change PHP version

I have installed PHP 7.0 from here and followed instructions to add the new php to my

but in a new terminal window
php -v
still shows the old default version.

The new version is used if I
source .profile
source .bash_profile
(tried both)

I have even added the new PHP path to my
but still no luck.

How can I get my mac to always use the new version of PHP by default?

Symink not an option as I'm on El Capitan.


export PATH=/usr/local/php5/bin:$PATH
export PATH=/usr/local/bin:$PATH
export PATH=$HOME/.composer/vendor/bin:$PATH

Answer Source

You should use ~/.bash_profile instead of ~/.bashrc file on Mac.

If source ~/.bash_profile can solve the problem, that means the file is not sourced when you open a new terminal. If you are using zsh, you should add source ~/.bash_profile to your ~/.zshrc file.

However, brew is a better option.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download