[en] Knowledge Install brew deprecated PHP version ([email protected], 5.6, 7.0) on Brew MacOS

PHP 5.6, PHP 7.0, and PHP 7.1 are out of support by the php group (Ref: PHP: Supported Versions), So brew also deprecated & remove it.
Now, only PHP 7.2 through 7.4 are officially supported by Brew and can be installed with
Code:
brew install [email protected]
so if you want to install PHP 5.6, PHP 7.0, or PHP 7.1 you will have to find it in other repo:
Code:
brew install openldap libiconv
brew tap exolnet/homebrew-deprecated
brew install [email protected]
Ref: https://getgrav.org/blog/macos-catalina-apache-multiple-php-versions

--- 2020-07-20 Update ---

[email protected] from exolnet/homebrew-deprecated have many problem like can't install pecl when I need it to install xdebug. So I found out another solution to install old version package on brew
When you run brew install [email protected] or brew search [email protected], It return this error
Code:
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
[email protected] was deleted from homebrew/core in commit d541efc:
  Remove [email protected]
  Closes https://github.com/Homebrew/homebrew-core/issues/47385.
  Signed-off-by: Sean Molenaar <[email protected]>
To show the formula before removal run:
  git -C "$(brew --repo homebrew/core)" show d541efc^:Formula/[email protected]
If you still use this formula consider creating your own tap:
  https://docs.brew.sh/How-to-Create-and-Maintain-a-Tap
You can see that formula [email protected] was removed on commit d541efc. So solution is, checkout file Formula/[email protected] from commit d541efc then install
Bash:
git -C "$(brew --repo homebrew/core)" checkout d541efc^ -- Formula/[email protected]
brew install [email protected]
then try to run php -v you'll get an error because this [email protected] only work with icu4c version 64 so install it (Ref: [en] Fix bug - Error "dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib" with php7.1)
Bash:
# version 64.2:
brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb
# now check available icu4c on your machine
brew info icu4c
# switch to icu4c version 64.2
brew switch icu4c 64.2
Ref: Install deprecated [email protected] in Homebrew
 
Last edited:

Facebook Comments

Top