Factsheet
/ March 21, 2023; 3 years ago (2023-03-21)
/ March 21, 2023; 3 years ago (2023-03-21)
visual studio code - Xdebug v3.0.2 with PHP v8.0.0 - Stack Overflow
Run Xdebug with XAMPP, NetBeans, PHP 8.2 - Stack Overflow
Using Xdebug with Eclipse and XAMPP (PHP 8) - Stack Overflow
Cannot load xdebug in PHP 8.0 - Stack Overflow
Videos
Please use Xdebug's wizard to find out which file to download.
You can only use DLLs that were made for the exact PHP minor version (8.0, 8.1, etc). You can't ever load a DLL that is made for PHP 7.3 with PHP 8.0 for example. Which is what the error message tells you.
There are some incompatibilities with Xdebug 3.1 on Windows due to compression support with zlib. In order to load Xdebug 3.1 on Windows, you need to have at least PHP 8.0.7 — the wizard will tell you that too.
Another option is need to check correct dll version with current PHP version, TS (Thread Safe) or Non TS version.
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.
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?
Step 1: goto https://xdebug.org/wizard.php
step 2: copy and paste your phpinfo output to textarea which will be displayed on https://xdebug.org/wizard.php
step 3: click on analyze my phpinfo() output button, it will analyze your system and based on that it will give you suitable php_xdebug.dll file that you need to put at D:\xampp\php\ext folder
step 4: edit your php.ini file and add following line zend_extension = D:\xampp\php\ext\your-php_xdebug.dll
step 5: Restart Server
Reference Video Tutorial : https://www.youtube.com/watch?v=HbJOP0YcSjs
complete video Tutorial for PHP Debug Example : Demo
Recent XAMPP version(mine is v3.2.2) already had the file php_xdebug.dll in xampp\php\ext folder , so we don't need go to https://xdebug.org/wizard.php for downloading the file.
Just open the file xampp\php\php.ini, add the codes:
[xdebug]
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
Restart the XAMPP, then you could see the xdebug is working by type php --version in CMD:

There's been only one update to Xdebug 3.4 since the alpha in May, and that was almost two months ago, but PHP 8.4.1 is now released Xdebug 3.4 is not released or has any updates. It's odd that almost no one that I can think of is even discussing it on the internet. I know they are not developed by the same team, but right now we can't debug PHP 8.4. Even on the GitHub project, the last commit was Oct 16th.
There's a 2 Nov update on Derick's Patreon but it's paywalled. Is it just one guy working on one of the most widely used debugging extensions for PHP?
Just curious. I wanted to get a head start with compatibility on PHP 8.4 but would have to work without a debugger so I'm going to wait.