With php72 I tried
pecl install xdebug but it doesn’t work for me. Tries to install to bad or undesirable locations.
The manual approach is the way to go, for now.
Download xdebug source: https://xdebug.org/files/xdebug-2.7.0alpha1.tgz
(other versions at https://xdebug.org/download.php)
Untar and build the source:
$ tar xvf xdebug-2.7.0alpha1.tgz
$ cd xdebug-2.7.0alpha1
$ cd modules
$ cp xdebug.so /usr/local/opt/php/lib/php/<somedir>
The directory where you copy the module is up to you, and the suggested dir above may get cleared out at the next php update, so you’ll have to go through the process again.
You also need to add some lines to php.ini or to a file you create in for ex. /usr/local/etc/php/7.1/conf.d/. The lines should look like:
In my case (php 7.2), I have a file
/usr/local/etc/php/7.2/conf.d/ext-xdebug.ini that contains these lines.
Then restart httpd service.