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

2

8

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?

Lait answered 8/2, 2019 at 14:28 Comment(0)
M
9

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
Maeganmaelstrom answered 8/2, 2019 at 14:33 Comment(6)
Thanks! the config-set of the pecl settings did it.Lait
Doesn't work for me in 2022Krouse
@Krouse what check which php maybe you use different php then pecl currently works against?Nagano
@Nagano the issue is that there is no longer an image / binary available for Ubuntu that will install xdebug on PHP7, because PHP7 is end of life.Krouse
Don't take any offense, but as I did since writing this question, was part ways with PHP to never ever come back. Welcome typescript/node, Python, Dart, Go, Kotlin, whatever you like, but I'd like PHP to go away gracefully for the good old times and keep the good memories.Lait
None taken but I've had my time with GO and now with Python and everyone has its ups and downs. In GO you have to check for every single error on every function call err != nil and Python abuses of classes. I could say Symfony code is more readable that what I've seen in Django. At least you have one class one file.Maeganmaelstrom
Y
10

Since other answers at current moment do not work anymore as PHP 7.x is deprecated the only workaround that is succesfull for xdebug is specifying the exact version. For example for PHP 7.4 the latest compatible Xdebug version is 3.1.6:

pecl install xdebug-3.1.6

Update 27 feb 2023 Based on question asked below how to make pecl install the latest available version of Xdebug for legacy PHP 7 you can use the command below:

XDEBUG_VERSION=$(git ls-remote --sort='version:refname' --tags https://github.com/xdebug/xdebug.git | grep -oh "3\.1\.[0-9]" | tail -1)
pecl install xdebug-$XDEBUG_VERSION

Which fetches the latest available tag in the 3.1 version range of the xdebug Github repository

Youngs answered 12/2, 2023 at 12:36 Comment(2)
Is there a way of asking for the latest version of xdebug 3.1? At the moment that is 3.1.6, but the 3.1 series is still getting security fixes (as of Feb 2023), so a 3.1.7 may well be released. Sadly, pecl install xdebug-3.1 doesn't work..Scintillant
>Is there a way of asking for the latest version of xdebug 3.1? @RichardSmith UPDATED: as a follow-up to my previous reply found fix to get latest available compatible xdebug version for installationYoungs
M
9

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
Maeganmaelstrom answered 8/2, 2019 at 14:33 Comment(6)
Thanks! the config-set of the pecl settings did it.Lait
Doesn't work for me in 2022Krouse
@Krouse what check which php maybe you use different php then pecl currently works against?Nagano
@Nagano the issue is that there is no longer an image / binary available for Ubuntu that will install xdebug on PHP7, because PHP7 is end of life.Krouse
Don't take any offense, but as I did since writing this question, was part ways with PHP to never ever come back. Welcome typescript/node, Python, Dart, Go, Kotlin, whatever you like, but I'd like PHP to go away gracefully for the good old times and keep the good memories.Lait
None taken but I've had my time with GO and now with Python and everyone has its ups and downs. In GO you have to check for every single error on every function call err != nil and Python abuses of classes. I could say Symfony code is more readable that what I've seen in Django. At least you have one class one file.Maeganmaelstrom

© 2022 - 2024 — McMap. All rights reserved.