PECL 安装 xdebug 失败,因为它发现内置的旧 PHP 而不是 homebrew 的最新版本

PECL install xdebug fails because it finds built-in older PHP instead of homebrew's latest version

我正在使用 pecl sudo pecl install xdebug 安装 xdebug,我得到:checking Check for supported PHP versions... configure: error: not supported. Need a PHP version >= 7.0.0 and < 7.3.0 (found 5.6.30)
我用homebrew安装了最新的PHP v7.2,但是pecl找到了过时的MacOS内置版本PHP,如何让pecl找到最新版本?

你能试试吗?

pecl -d php_suffix=7.2 install <package>

您也可以尝试更改 pecl 设置:

sudo pecl config-set php_ini /etc/php/7.2/cli/php.ini
sudo pecl config-set ext_dir /usr/lib/php/******/
sudo pecl config-set bin_dir /usr/bin/
sudo pecl config-set php_bin /usr/bin/php7.2
sudo pecl config-set php_suffix 7.2

如果没有任何效果,请使用强制:

sudo pecl install -f