'PHP - installing Xdebug on Mac with XAMPP (Unix File)

I have a trouble installing Xdebug on my PHP project. I am on macOS Monterey M1 and I am using XAMPP for launching project on PHP version 7.4.28.

I followed the instructions given on their official webpage:

Download xdebug-3.1.4.tgz
Run: cd xdebug-3.1.4
Run: phpize (See the FAQ if you don't have phpize).
Run: ./configure
Run: make
Run: cp modules/xdebug.so /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20190902
Update /Applications/XAMPP/xamppfiles/etc/php.ini and add the line:
zend_extension = xdebug

When typing php -v in my terminal I first get few errors like:

HP Startup: Unable to load dynamic library 'php_soap.dll' (tried: /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20190902/php_soap.dll

I tried following the path and I saw that in the specific folder there is Unix Executable File and not the folder with added files..

enter image description here

How can I bypass this? I know XAMPP is not the best solution for Mac, but I see that it has been used by others.



Solution 1:[1]

Finally solved it and for everyone having the same issue:

On M1, your PHP can either be compiled for the x86_64 or arm64 architectures. The pecl tool can't guess which one it is, so if your PHP is compiled with say x86_64 and the default compiler setting is arm64, then you'll get the above warning. This means, that sometimes you have to run PECL with:

arch -x86_64 sudo pecl install xdebug

The arch -x86_64 part will set up the environment to compile Xdebug as x86_64 binary.

Thank you all for supp?rt!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 keymon