我正在尝试在我的 Mac m1 上安装 Xdebug,我按照此页面(https://xdebug.org/docs/install)进行安装。这是我遵循的步骤:
步骤1 => 转到cmd:arch -x86_64 sudo pecl install xdebug
step2 => 去php.ini删除这行代码
zend_extension="xdebug.so"
Run Code Online (Sandbox Code Playgroud)
步骤3 => 转到 php.ini 添加此内容
[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"
Run Code Online (Sandbox Code Playgroud)
步骤4 => 转到cmd:php -v
错误显示:
我怎么解决这个问题?谢谢
Der*_*ick 17
这里发生的情况是,您构建了x86_64扩展的构建,但自制程序可能使用了该arm64e架构。这些架构不兼容。
您可以通过以下方式验证您的 PHP 架构:
file `which php`
Run Code Online (Sandbox Code Playgroud)
如果是这样arm64e,那么您需要文档中的原始命令:
sudo pecl install xdebug
Run Code Online (Sandbox Code Playgroud)
如果是x86_64,那么您需要针对 Apple 的双架构修改命令:
arch -x86_64 sudo pecl install xdebug
Run Code Online (Sandbox Code Playgroud)
对于它的价值,文档说:在 Apple M1 硬件上,您可能需要使用...,而不是必须。
Kyl*_*enn 15
arch -arm64 pecl install xdebugERROR: failed to mkdir /opt/homebrew/Cellar/php/8.2.4/pecl/20220829,运行rm /opt/homebrew/Cellar/php/8.2.4/pecl然后重新运行上面的命令Build process completed successfully
Installing '/opt/homebrew/Cellar/php/8.2.4/pecl/20220829/xdebug.so'
Run Code Online (Sandbox Code Playgroud)
php --iniopen /opt/homebrew/etc/php/8.2/php.inicd /opt/homebrew/etc/php/8.2/conf.dtouch xdebug.iniopen 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"
Run Code Online (Sandbox Code Playgroud)
运行php --version应该会显示一行关于 xdebug 的内容(就像这样with Xdebug v3.2.1)