How do I upgrade PHP in Mac OS X?
You may want to check out Marc Liyanage's PHP package. It comes in a nice Mac OS X installer package that you can double-click. He keeps it pretty up to date.
Also, although upgrading to Snow Leopard won't help you do PHP updates in the future, it will probably give you a newer version of PHP. I'm running OS X 10.6.2 and it has PHP 5.3.0.
I use this: https://github.com/Homebrew/homebrew-php
The command is:
$ xcode-select --install$ brew tap homebrew/dupes$ brew tap homebrew/versions$ brew tap homebrew/homebrew-php$ brew options php56$ brew install php56
Then config in your .bash_profile
or .bashrc
# Homebrew PHP CLIexport PATH="$(brew --prefix homebrew/php/php56)/bin:$PATH"
I think one simple way to do it, is:
1 - Check you where is your current PHP:
$ which php$ /usr/local/bin/php
You see? Usually, our commands that we run is a link in /usr/local/bin so...
2 - Unlink this current link of PHP
unlink /usr/local/bin/php
If you prefere, before unlink it, check the path and then remove php files (do ls -al /usr/local/bin
| grep php and then rm -rf
into desired path)
3 - Install PHP 7.1
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.1
4 - Create new link (using php 7.1 bin that you have installed)
ln /usr/local/php5-7.1.9-20170914-100859/bin/php /usr/local/bin/php
Like I said, its a simple way I think.