Installing Xdebug on M1 MacBook Pro can be very tricky due to the CPU architecture changed.
This post will show how I install it on my machine:
- Make sure you install ur PHP through brew. For me, I have PHP v7.4.15 and perl v5.30.2 installed
- Install Xdebug with perl:
arch -arm64 sudo pecl uninstall xdebug
- Locate the Xdebug path in your system. For me, it’s installed on
/opt/homebrew/Cellar/[email protected]/7.4.15_1/pecl/20190902/xdebug.so
- Make sure
xdebug.so
is loaded correctly inphp.ini
. You can check the following block.
zend_extension="/opt/homebrew/Cellar/[email protected]/7.4.15_1/pecl/20190902/xdebug.so" xdebug.mode=debug xdebug.client_host=localhost xdebug.client_port=9000
DONE~
You may start using Xdebug to debug ur PHP application. =)