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.
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
You can
brew upgrade php7
orbrew uninstall
old php version.Last, I recommend you
brew install php-version
, php-version can help you change your php versiontry to use the command, its working fine with me
Install php
Install the required PHP to your PATH
Then make sure it's all working
This command will show you where your ini file is loaded
Try to use below command
brew update brew install php@72
If it shows below error,
try
brew install php@7.2
The simplest way to update the version of php on Mac is via Homebrew.
If you do not have brew please visit https://brew.sh/ or install via command in terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
When finished installing Homebrew, run the following commands:
You can also change the version to 7.0 by replacing the command from above commands from
brew install php@71
tobrew install php@70
.You can check the output by command.
If the output of
php -v
still doesn’t echoes the version 7, simply type this command and hit enter in terminal.