Mac php update

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

I tried 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 the message below:

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

Not sure what went wrong and why it won’t be updated ...

Any ideas?

Thanks.

+12
source share
5 answers

Use Homebrew:

Perhaps I would recommend installing homebrew to manage such installations. After installation, you can simply run the following command to install php7.1

 brew update brew install php@71 
+7
source

The easiest way to upgrade your php version on Mac is through Homebrew.

If you do not have coffee, please visit https://brew.sh/ or install using the command in the terminal:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

After the Homebrew installation is complete, run the following commands:

 brew update && brew upgrade brew tap homebrew/dupes brew tap homebrew/versions brew tap homebrew/homebrew-php brew unlink php@56 brew install php@71 

You may get an error if PHP 5.6 has not been installed brew before, but don’t worry, you can just continue.

You can also change the version to 7.0 by replacing the above commands with brew install php@71 with brew install php@70 .

You can check the output by command.

 php -v 

If php -v output still doesn't reflect version 7, just type this command and hit enter in terminal.

 export PATH=/usr/local/php5/bin:$PATH 
+24
source

Install php

 brew install php@7.2 

Install the required PHP in your path

 echo 'export PATH="/usr/local/opt/ php@7.2 /bin:$PATH"' >> ~/.bash_profile echo 'export PATH="/usr/local/opt/ php@7.2 /sbin:$PATH"' >> ~/.bash_profile source ~/.bash_profile 

Then make sure everything works

 php -v php --version 

This command will show you where your INI file is uploaded.

 php --ini 
+9
source

You can brew upgrade php7 or brew uninstall old version of php.

Finally, I recommend you brew install php-version , php version can help you change php version

0
source

try using the command, it works fine with me

 curl -s https://php-osx.liip.ch/install.sh | bash -s 7.3 
0
source

Source: https://habr.com/ru/post/1014455/


All Articles