PHP 7.3.8在macOS 10.15 Catalina的安装中缺少zip扩展。

13

MacOS 10.15 Catalina 安装的 PHP7.3.8 版本不包含 PHP 扩展 zip。我该如何查找和安装该 zip 扩展。

Brew 安装 php73-zip 报告没有可用的公式名称。

2个回答

23

我在安装Mac上的ext-zip中找到了一些解决方案。

在将我的Mac更新到Catalina后,我遇到了同样的问题。这是对我起作用的方法。

brew update
brew install php@7.3
brew link php@7.3

然后重新加载你的控制台。

它将安装带有zip模块的PHP 7.3.10。您可以使用 PHP -v 检查版本,使用 PHP -m 检查模块。


附注:如果您没有安装Homebrew(brew),您可以访问:https://brew.sh/

Homebrew(brew)的基本安装

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

将其粘贴到 macOS 终端提示符中。


brew link 是关键! - funder7

-2

Homebrew 公式/软件包 php 默认启用了 zip 扩展。

Homebrew 是 Homebrew,它不是 MacPorts 或任何其他 Linux 软件包管理器。无需安装其他软件包来启用 zip 扩展。请在报告问题之前检查事实。

# https://github.com/Homebrew/homebrew-core/blob/48a3a49c57b22eb1450b01e7867cf054a89c5a7b/Formula/php.rb#L31
class Php < Formula
  desc "General-purpose scripting language"
  homepage "https://www.php.net/"
  url "https://www.php.net/distributions/php-7.3.10.tar.xz"
  sha256 "42f00a15419e05771734b7159c8d39d639b8a5a6770413adfa2615f6f923d906"

...

  depends_on "libsodium"
  depends_on "libzip"
  depends_on "openldap"

...

      --enable-wddx
      --enable-zip
      --with-apxs2=#{Formula["httpd"].opt_bin}/apxs

...

      --with-libedit#{headers_path}
      --with-libzip
      --with-mhash#{headers_path}
...

2
也许你还没有理解问题所在。当你升级到macOS 10.15 Catalina版本时,安装的PHP并不包含zip扩展。这就是我一直试图解决的问题。 - DBerg

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接