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.
arch -arm64 pecl install xdebug
ERROR: failed to mkdir /opt/homebrew/Cellar/php/8.2.4/pecl/20220829, run
rm /opt/homebrew/Cellar/php/8.2.4/peclthen re-run above command
Build process completed successfully Installing '/opt/homebrew/Cellar/php/8.2.4/pecl/20220829/xdebug.so'
;XDebug zend_extension="/opt/homebrew/Cellar/php/8.2.4/pecl/20220829/xdebug.so" xdebug.mode=debug xdebug.start_with_request=yes xdebug.client_port=9003 ;xdebug.mode=profile xdebug.output_dir="/tmp"
php --version should show you a line about xdebug (like so
with Xdebug v3.2.1)
If you encounter this:
which phpresult shows
Mach-O 64-bit executable arm64.
sudo pecl install xdebugstill resulted in the wrong architecture problem.
arch -arm64e sudo pecl install xdebug
arch -arm64 shown bad cpu type error in my case.
pecl install xdebug doesn't work. run it with
don't try the arch x84 command as it wont work anymore, since php is now build in arm cpu architecture.
sudo pecl install xdebug
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
Welcome to the Q&A site for web developers. Here you can ask a question about the problem you are facing and get answers from other experts. We have created a user-friendly interface so that you can quickly and free of charge ask a question about a web programming problem. We also invite other experts to join our community and help other members who ask questions. In addition, you can use our search for questions with a solution.
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.