在 MAC 上使用 Homebrew 安装 PHP

2022-01-05 00:00:00 macos homebrew php phpmyadmin

我正在尝试使用 Homebrew 在我的 MAC 机器上安装 PHP.我正在使用以下命令:brew install php

I am trying to install PHP on my MAC machine using Homebrew. I am using the following command: brew install php

但是,我收到以下错误:

However, I am getting the following errors:

Error: No available formula with the name "php" 
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
Error: No formulae found in taps.

推荐答案

更新

2018 年 2 月,php72 公式(当时 PHP 的当前版本)已移入核心 Homebrew Tap 并重命名为 php.

Update

In February 2018, the php72 formula (the current version of PHP at that time) has been moved into the core Homebrew tap and renamed as php.

homebrew/php 点击已被弃用 2018 年 1 月,2018 年 3 月 31 日存档.其中包含的公式已不再可用.

The homebrew/php tap has been deprecated in January 2018 and then archived on March 31, 2018. The formulas it contained are not available any more.

自 2018 年 2 月以来,使用 Homebrew 安装 PHP 就像:

Since February 2018, installing PHP using Homebrew is as easy as:

$ brew install php

旧的 PHP 版本 仍在维护 可以使用新的 @ 安装 版本约定(PHP 7.1 是 php@7.1).

The older PHP versions that are still maintained can be installed using the new @ convention for versions (PHP 7.1 is php@7.1).

PHP 生态系统存在于 homebrew/php 水龙头中.您可以找到六个版本的解释器(从 5.37.1)、它们的扩展以及一些与 PHP 相关的工具.

The PHP ecosystem lives in the homebrew/php tap. You can find there six versions of the interpreter (from 5.3 to 7.1), extensions for them and some PHP-related tools.

为了安装 PHP,你必须先安装 homebrew/php 点击(这只需要一次):

In order to install PHP you have to install the homebrew/php tap first (this is needed only once):

$ brew tap homebrew/php
$ brew install php70

或者您可以通过运行以下命令在一个步骤中完成这两个操作:

Or you can do both operations in a single step by running:

$ brew install homebrew/php/php70

<小时>

您可以通过先搜索 php 来发现所有这些:

$ brew search php

相关文章