0

I followed the instructions on xdebug.org to install xdebug on my m2 mac. For compiling the extension I installed php on my machine, so I installed the latest 8.2 I also installed xdebug with pecl with -arm64 (for my M2 as told by file which php) and and it loads when I try php -v But on xampp I seem to have another php installation, which is 8.1, as it says in the phpinfo() on localhost. The extension I created (obviously using the system 8.2 for compilation) with the 8.1 localhost-phpinfo on xdebug.org/wizard is in place. When I check /Applications/XAMPP/xamppfiles/bin/php, it shows the reason why the extension is not loaded:

Failed loading /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so:  dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so, 0x0009): tried: '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

There it says need "x86_64" although my mac is M2 and so arm64. Is it possible that I have a x86_64 php in xampp and arm64 php in my system php? How can I get a suitable xdebug-3.2.2.tgz? Or should I reinstall xampp with hopefully a arm64 php 8.2?

I am lost.

1 Answers1

0

Is it possible that I have a x86_64 php in xampp and arm64 php in my system php?

Yes, that is very likely. From what I understand, XAMPP is still x86_64 and native PHP is arm64.

How can I get a suitable xdebug-3.2.2.tgz?

The source code is suitable for both. The binary that is created from the source code needs to be of either variant.

Or should I reinstall xampp with hopefully a arm64 php 8.2?

That should do the trick. Or even using their new 8.1.17 release. Their website says that "It supports intel (x64) or Apple M1 (arm64) CPUs". I can't verify that, as I don't have macOS.

Alternatively, you can use:

  • arch -x86_64 sudo pecl install -f xdebug to create an intel/x64 xdebug.so and copy that to /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so for your XAMPP install
  • reinstall Xdebug for your native PHP with arch -arm64 sudo pecl install -f xdebug. The latter overwrites the one that is created first. The -f flag is needed for PECL to allow that.
Derick
  • 35,169
  • 5
  • 76
  • 99