【问题标题】:Xdebug installation failed because "phpize" failed on macOS Big Sur with MAMPXdebug 安装失败,因为使用 MAMP 在 macOS Big Sur 上“phpize”失败
【发布时间】:2021-01-20 15:18:45
【问题描述】:

我正在尝试在我的 Mac 上安装 Xdebug,因为我正在使用 MAMP 进行本地开发。

我尝试使用pecl 在终端中运行以下命令来安装 Xdebug:

 sudo pecl install xdebug

但是会发生以下情况:

hello-world:~ lois$ sudo pecl install xdebug
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading xdebug-2.9.8.tgz ...
Starting to download xdebug-2.9.8.tgz (245,293 bytes)
...................................................done: 245,293 bytes
91 source files, building
running: phpize
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
autom4te: need GNU m4 1.4 or later: /usr/bin/m4
ERROR: `phpize' failed

看起来 phpize 试图定位一些不存在的文件,然后失败了。

xdebug 安装页面中没有提到这些文件,所以我不确定我做错了什么。

【问题讨论】:

  • 你安装了 phpize / php-dev 等吗? stackoverflow.com/questions/3108937/…
  • 堆栈跟踪表明 phpize 实际上正在运行。但它失败了
  • 你有没有像错误信息告诉你的那样pecl channel-update pecl.php.net
  • @RiggsFolly 是的,但发生了完全相同的错误

标签: php xdebug pecl


【解决方案1】:

好的,所以我终于找到了解决问题的方法。

第一个解决方案:如果您使用的是 MAMP

首先,我实际上是在使用 MAMP 进行本地开发。如果您也遇到这种情况,您确实不需要需要安装 Xdebug。

原因是,Xdebug 已经安装了 MAMP。

您只需要做两件事:

  1. 修改 MAMP 中的 php.ini 文件:https://dillieodigital.wordpress.com/2015/03/10/quick-tip-enabling-xdebug-in-mamp-for-osx/
  2. 设置您的 IDE 以使用 Xdebug。我正在使用 VS Code,有很多关于如何使用 Xdebug 设置 VS Code 的教程。

第二种解决方案:你没有使用 MAMP,所以你绝对想在你的 Mac 上安装 Xdebug

如果您在使用 phpize 时遇到同样的问题,那是因为新版本的 macOS 具有不同的文件夹结构。

Xdebug 需要一个特定的结构,它不再存在。这种情况,看一下这篇文章:https://bbqsoftwares.com/blog/xdebug-catalina

【讨论】:

    【解决方案2】:

    Autoconf 可能丢失

    运行 brew install autoconf 并重试

    在 Apple M1 Silicon 上确保使用 arch -x86_64 sudo pecl install xdebug 安装 xdebug

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-31
      • 2021-02-28
      • 1970-01-01
      • 2020-12-18
      相关资源
      最近更新 更多