想当然的进来就是一行$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