Installing Xdebug on PHP 8.1 installed with Homebrew
source link: https://akrabat.com/installing-xdebug-on-php-8-1-installed-with-homebrew/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Installing Xdebug on PHP 8.1 installed with Homebrew
I have recently set up a new M2 MacBook Air and as usual, installed Homebrew and then installed PHP. Homebrew is always up to date, so it installed PHP 8.1 for me.
Again, as usual, I installed Xdebug using pecl install xdebug.
This whirrs and clicks for a while downloading and compiling the xdebug.so and then fails with:
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
Investigating, I found that /opt/homebrew/Cellar/php/8.1.8/pecl is a symlink to /opt/homebrew/lib/php/pecl, however, this directory doesn’t exist. So to fix, I created the directory and installed Xdebug again:
mkdir /opt/homebrew/lib/php/pecl pecl install xdebug
This time it worked:
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
A quick test shows that all is now as it should be:
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
This article was posted on 26 July 2022 in PHP, Software
Thoughts? Leave a reply Cancel reply
Your email address will not be published. Required fields are marked *
Comment *
Name *
Email *
Website
Post navigation
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK