首页  >  问答  >  正文

在 M1 Apple 上安装 PHP 7.4 的 Xdebug

我想用 M1 在我的 Mac 上安装 Xdebug。由于我参加的项目,我使用 PHP 7.4.32。我无法切换 PHP 版本。

当我尝试安装 Xdebug 时,它说我的 PHP 版本必须更新到 8.0.0,但我仍然想使用 7.4.32。

$ pecl install xdebug
> pecl/xdebug requires PHP (version >= 8.0.0, version <= 8.2.99), installed version is 7.4.32
No valid packages found
install failed

当前的 PHP 版本是随 homewbrew 一起安装的。

$ brew services list
php          none  19968 user  ~/Library/LaunchAgents/homebrew.mxcl.php.plist
php@7.4      started      user  ~/Library/LaunchAgents/homebrew.mxcl.php@7.4.plist
php@8.0      none

我还运行 brew update 命令。一切都很好。

如何安装适用于 PHP 7.4.32 的 Xdebug?

P粉052686710P粉052686710323 天前789

全部回复(1)我来回复

  • P粉155832941

    P粉1558329412023-11-06 09:22:54

    根据兼容性页面,PHP 8.0 以下的任何版本都不支持 Xdebug 3.2。

    为了安装 PHP 7.4 的 Xdebug,您需要告诉 PECL 您想要安装的版本。支持 PHP 7.4 的最后一个 Xdebug 版本是 Xdebug 3.1.6,您可以使用 pecl install xdebug-3.1.6 进行安装。

    但是您确实应该升级,因为 PHP 7.4 或 Xdebug 3.1 仍不受支持。

    回复
    0
  • 取消回复