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 pecl install xdebug
doesn't work. run it with sudo
command. don't try the arch x84 command as it wont work anymore, since php is now build in arm cpu architecture.
Solution:
sudo pecl install xdebug
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.