Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I install php7.1 using brew in 2020

Tags:

php

homebrew

I refered to some tutorials in google, but they do not work, I guess those methods are outdated.

eg https://developerjack.com/blog/2016/installing-php71-with-homebrew/

I got error when I run "brew install [email protected]"

macOS Catalina 10.15.4

executed
brew install

brew tap
caskroom/cask
homebrew/bundle
homebrew/cask
homebrew/core
homebrew/services
mongodb/brew

brew -v
Homebrew 2.2.12
Homebrew/homebrew-core (git revision 53ccd; last commit 2020-04-08)
Homebrew/homebrew-cask (git revision 322a2; last commit 2020-04-08)

brew install [email protected]
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
No changes to formulae.

Error: No available formula with the name "[email protected]" 
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
like image 379
Derek Lam Avatar asked Apr 08 '20 12:04

Derek Lam


People also ask

How do I install a specific version of PHP on Mac?

To install a specific version of PHP, you simply have to use the keyword install following the package containing the PHP version of your choice, without the dot.


2 Answers

Up until the end of March 2018, all PHP related brews were handled by Homebrew/php tab, but that has been deprecated, so now we use what's available in the Homebrew/core package. This should be a better maintained, but is a much less complete, set of packages.

PHP 5.6, PHP 7.0, and PHP 7.1 have been deprecated and removed from Brew because they are out of support, and while it's not recommended for production, there are legitimate reasons to test these unsupported versions in a development environment.

Remember only PHP 7.2 through 7.4 are officially supported by Brew so if you want to install PHP 5.6, PHP 7.0, or PHP 7.1 you will need to add this tap:

$ brew tap shivammathur/php

Reference here

like image 198
marceloomiqueles Avatar answered Oct 21 '22 08:10

marceloomiqueles


[email protected] is deprecated https://www.php.net/supported-versions.php.

So try to install with other repo

brew install openldap libiconv
brew tap exolnet/homebrew-deprecated
brew install [email protected]

https://devhoi.com/threads/install-brew-deprecated-php-version-php-7-1-5-6-7-0-on-brew-macos.25/

like image 3
Huy Phan Avatar answered Oct 21 '22 09:10

Huy Phan