I installed Xdebug using homebrew for my system’s PHP and it went fine.
But I’m trying to debug in my IDE, PhpStorm, which is using XAMPP as the server. It’s a different PHP installation (I’m pretty sure!?)
I say this because obviously, it’s missing the "xdebug.." and "Zend OPache.." stuff in the version command. I’m running that version command from PhpStorm’s run command tool, BTW.
Lastly, I super know it’s not installed due to this blinding reminder that I’m absolutely, beyond any possible shadow of a doubt, lost in the sauce.
I think it’s about time I learn how to use the ol’ terminal.
Any tips on how to use homebrew to install Xdebug on XAMPP’s PHP?
2
Answers
Solved.
I modified XAMPP's php.ini file to point to the xdebug.so that homebrew installed,
zend_extension="/opt/homebrew/Cellar/php/8.2.3/pecl/20220829/xdebug.so"
Then, I restarted the XAMPP server and ran this in terminal
/Applications/XAMPP/xamppfiles/bin/php -v
Before the expected PHP info, there were some errors. Several times in the warnings it stated "...
(mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')
..." Oops.. I swore I chose x86_64..So, I ran the following in terminal:
pecl uninstall xdebug
Then,
arch -x86_64 sudo pecl install xdebug
Following that I again ran
/Applications/XAMPP/xamppfiles/bin/php -v
and, voila!Xdebug installed :] Works in my IDE too.
Homebrew has to be used in a consistent way: you can’t use it to install an extension to a program installed by another way. If XAMPP is using its own set of paths and stuff, Homebrew can difficulty adapt to it: it’s not made for that situation.
Why don’t you change your "PHP executable" and "Configuration file" options to the homebrew ones?