繁体   English   中英

Xdebug 安装失败,因为“phpize”在带有 MAMP 的 macOS Big Sur 上失败

[英]Xdebug installation failed because "phpize" failed on macOS Big Sur with MAMP

我正在尝试在我的 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 安装页面中没有提到这些文件,所以我不确定我做错了什么。

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

第一个解决方案:如果您使用的是 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

Autoconf 可能丢失

运行brew install autoconf

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM