user2303213
user2303213

Reputation: 93

How do I reinstall php on a mac?

I have been wanting to upgrade php5 to php7 on my macbook but i just don't know how. I tried using homebrew and a couple other methods I found online but I just don't know how to complete it.

As a result php5 has been deleted from /usr/local.

How can i get php5 back and then how do i upgrade it to php7?

I want the newest version because I have a minecraft server that I run on my computer that used to use php5 but now requires php7. I have the latest macbook with the latest os.

Upvotes: 1

Views: 6256

Answers (1)

Tuan Duong
Tuan Duong

Reputation: 515

As you are using homebrew, you can go with homebrew-php. You can install multiple version of PHP with this, and easily switch the version if you want

Or, you can use homebrew with php as usual

brew tap josegonzalez/php
brew tap homebrew/dupes
brew install php55

If you want to upgrade to PHP 7 but still keep current PHP 5, you should unlink PHP 5 first

brew unlink php55
brew install php70

Then you can use PHP 7. And if you want to switch back to PHP 5, just unlink PHP 7 and link PHP 5

brew unlink php70
brew link php55

Upvotes: 3

Related Questions