Updating php version on mac

I want to update php version, currently I have 5.5.38 and I want 7.1

What I tried so far is using this command:

curl -s https://php-osx.liip.ch/install.sh | bash -s 7.1

I tried several different versions but none of them worked. It opens bash_profile for a second and then I get Received SIGHUP or SIGTERM and message below:

Buffer written to /Users/Morpheus/.bash_profile.save.6

Not sure what went wrong and why it won't update...

Any ideas?

Thanks.


Install php

brew install [email protected]

Install the required PHP to your PATH

echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

Then make sure it's all working

php -v
php --version

This command will show you where your ini file is loaded

php --ini

Use Homebrew:

I would probably recommend installing homebrew to manage such installations for you. With that installed you can just run the following command to install php7.1

brew update
brew install php@71