What happened here is that you built ax86_64
build of the extension, but homebrew likely used thearm64e
architecture. These architectures are not compatible.
You can verify what your PHP's architecture is with:
file `which php`
If that saysarm64e
, then you need the original command from the documentation:
sudo pecl install xdebug
And if it'sx86_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
, runrm /opt/homebrew/Cellar/php/8.2.4/pecl
then re-run above commandBuild process completed successfully
Installing '/opt/homebrew/Cellar/php/8.2.4/pecl/20220829/xdebug.so'
php --ini
open /opt/homebrew/etc/php/8.2/php.ini
cd /opt/homebrew/etc/php/8.2/conf.d
touch xdebug.ini
open xdebug.ini
;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"
Runningphp --version
should show you a line about xdebug (like sowith Xdebug v3.2.1
)
If you encounter this:
which php
result showsMach-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.
ifpecl install xdebug
doesn't work. run it withsudo
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
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.
https://www.php.net/
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.