简体   繁体   中英

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

在此处输入图像描述

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.

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM