想当然的进来就是一行
$sudo pecl install xdebug
pecl/xdebug requires PHP (version >= 7.2.0, version <= 8.0.99), installed version is 7.1.33
No valid packages found
install failed
查阅了一下 xdebug 的下载页,默认装置的 xdebug3 曾经不反对 php7.1 了。
php7.1 只配装置 xdebug2,依据在下载页查到的最初一个反对 php7.1 的版本是 2.9.8
$sudo pecl install xdebug-2.9.8
downloading xdebug-2.9.8.tgz ...
Starting to download xdebug-2.9.8.tgz (245,293 bytes)
...................................................done: 245,293 bytes
Build process completed successfully
Installing '/opt/homebrew/Cellar/php@7.1/7.1.33/pecl/20160303/xdebug.so'
install ok: channel://pecl.php.net/xdebug-2.9.8
Extension xdebug enabled in php.ini
检查一下是否装置胜利
$php -v
PHP 7.1.33 (cli) (built: Dec 25 2020 07:27:59) (NTS)
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Xdebug v2.9.8, Copyright (c) 2002-2020, by Derick Rethans
with Zend OPcache v7.1.33, Copyright (c) 1999-2018, by Zend Technologies
$php -m | grep debug
xdebug
Xdebug