skip to Main Content

I installed Xdebug using homebrew for my system’s PHP and it went fine.

enter image description here

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!?)

enter image description here

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.

enter image description here

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


  1. Chosen as BEST ANSWER

    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!

    PHP 8.2.0 (cli) (built: Dec 29 2022 08:42:31) (NTS)
    Copyright (c) The PHP Group
    Zend Engine v4.2.0, Copyright (c) Zend Technologies
        with Xdebug v3.2.0, Copyright (c) 2002-2022, by Derick Rethans
    

    Xdebug installed :] Works in my IDE too.


  2. 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?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search