首页 > 解决方案 > 在 OSX 上将 IMAP 添加到 PHP 7.2

问题描述

我在 OS X El Capitan 上使用 PHP 7.2,使用 Homebrew 安装(当然)。现在我想使用 PHP 的 IMAP 扩展中的一些 IMAP 函数,但是无论我搜索什么,我都找不到在 OSX 上添加扩展的方法。

我尝试过的一些事情......当然,我尝试了最常用的方法:

$ brew reinstall php --with-imap

然而这失败了,返回:

Warning: php: this formula has no --with-imap option so it will be ignored!

我发现顺便提到的另一种方法也失败了:

$ brew install php72-imap

Error: No available formula with the name "php72-imap" 
==> 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.

我不确定该朝哪个方向发展。我确信有一种简单的、可能有记录的方法可以做到这一点,但我还没有找到。也许我只是在错误的地方寻找并使用错误的搜索词......

标签: phpmacoshomebrewphp-imap

解决方案


Kevin Abel提供了一些从Homebrew/core中删除的 PHP 扩展。您可以通过以下方式安装 IMAP 扩展:

brew tap kabel/php-ext
brew install php-imap

要安装特定版本,例如 7.2,请使用:

brew install php@7.2-imap

推荐阅读