我如何在2020年使用brew安装php7.1

时间:2020-04-08 12:25:26

标签: php homebrew

我在google中提到了一些教程,但是它们不起作用,我猜那些方法已经过时了。

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

当我运行“ brew install php@7.1”时出现错误

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 php@7.1
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
No changes to formulae.

Error: No available formula with the name "php@7.1" 
==> 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.

2 个答案:

答案 0 :(得分:16)

直到2018年3月,所有与PHP相关的Brew都由Homebrew/php选项卡处理,但已弃用,因此现在我们使用Homebrew/core包中的可用内容。应该可以更好地维护它,但是不完整的软件包集。

PHP 5.6 PHP 7.0 PHP 7.1 已被弃用,并从Brew because they are out of support中删除,而在< strong>不推荐用于生产环境,有正当的理由在开发环境中测试这些不受支持的版本。

仅记住 PHP 7.2到7.4 受Brew正式支持,因此如果您要安装 PHP 5.6 PHP 7.0 PHP 7.1 ,则需要添加此点击:

$ brew tap exolnet/homebrew-deprecated

Reference here

答案 1 :(得分:2)

不推荐使用PHP@7.1 https://www.php.net/supported-versions.php

所以尝试与其他仓库一起安装

brew install openldap libiconv
brew tap exolnet/homebrew-deprecated
brew install php@7.1

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