J’ai récemment configuré un nouveau MacBook Air M2 et, comme d’habitude, installé Homebrew, puis installé PHP. Homebrew est toujours à jour, il a donc installé PHP 8.1 pour moi.
Encore une fois, comme d’habitude, j’ai installé Xdebug en utilisant pecl installer xdebug.
Cela tourne et clique pendant un certain temps lors du téléchargement et de la compilation de xdebug.so, puis échoue avec :
rob@ardent ~ $ pecl install xdebug downloading xdebug-3.1.5.tgz ... Starting to download xdebug-3.1.5.tgz (232,070 bytes) ... Build process completed successfully Installing '/opt/homebrew/Cellar/php/8.1.8/pecl/20210902/xdebug.so' PHP Warning: mkdir(): File exists in /opt/homebrew/Cellar/php/8.1.8/share/php/pear/System.php on line 294 ERROR: failed to mkdir /opt/homebrew/Cellar/php/8.1.8/pecl/20210902
En cherchant, j’ai trouvé que /opt/homebrew/Cellar/php/8.1.8/pecl est un lien symbolique vers /opt/homebrew/lib/php/pecl, cependant, ce répertoire n’existe pas. Donc, pour réparer, j’ai créé le répertoire et réinstallé Xdebug :
mkdir /opt/homebrew/lib/php/pecl pecl install xdebug
Cette fois ça a marché :
rob@ardent ~ $ pecl install xdebug downloading xdebug-3.1.5.tgz ... Starting to download xdebug-3.1.5.tgz (232,070 bytes) ... Build process completed successfully Installing '/opt/homebrew/Cellar/php/8.1.8/pecl/20210902/xdebug.so' install ok: channel://pecl.php.net/xdebug-3.1.5 Extension xdebug enabled in php.ini
Un test rapide montre que tout est maintenant comme il se doit :
rob@ardent ~ $ php -v PHP 8.1.8 (cli) (built: Jul 8 2022 10:46:35) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.8, Copyright (c) Zend Technologies with Xdebug v3.1.5, Copyright (c) 2002-2022, by Derick Rethans with Zend OPcache v8.1.8, Copyright (c), by Zend Technologies