I'm trying to install Xdebug on my Mac m1, I followed this page(https://xdebug.org/docs/install) to install. This is the step I followed:
step1 => go to cmd: arch -x86_64 sudo pecl install xdebug
step2 => go to php.ini delete this line of code
zend_extension="xdebug.so"
step3 => go to php.ini add this
[xdebug]
zend_extension=/opt/homebrew/lib/php/pecl/20190902/xdebug.so
xdebug.mode=debug
xdebug.client_host=127.0.0.1
xdebug.client_port="9003"
step4 => go to cmd: php -v
The error shows:
How can I solve this problem? Thanks
What happened here is that you built a x86_64
build of the extension, but homebrew likely used the arm64e
architecture. These architectures are not compatible.
You can verify what your PHP's architecture is with:
file `which php`
If that says arm64e
, then you need the original command from the documentation:
sudo pecl install xdebug
And if it's x86_64
, then you need the command modified for Apple's dual architecture:
arch -x86_64 sudo pecl install xdebug
For what it's worth, the docs say: On Apple M1 hardware, you might instead need to use..., not must.
If you encounter this:
which php
result shows Mach-O 64-bit executable arm64
.sudo pecl install xdebug
still resulted in the wrong architecture
problem.Try this:
arch -arm64e sudo pecl install xdebug
Note: arch -arm64
shown bad cpu type error in my case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With