Search code examples
phpxdebugpearpeclphp-7.2

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


I'm installing xdebug with pecl sudo pecl install xdebug and I get: 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)
I installed the latest PHP v7.2 with homebrew, but pecl finds the outdated MacOS built-in version of PHP, how can I make pecl find the latest version?


Solution

  • Can you try?

    pecl -d php_suffix=7.2 install <package>

    Also you can try to change pecl settings:

    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
    

    And in case nothing works use the force:

    sudo pecl install -f