3

无法在 Big Sur 下的新 Apple Silicon M1 下安装 XDebug - 使用pecl install xdebug并运行后php --ini出现以下错误:

PHP Warning:  Failed loading Zend extension 'xdebug.so' (tried: /opt/homebrew/lib/php/pecl/20190902/xdebug.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/xdebug.so, 9): no suitable image found.  Did find:
        /opt/homebrew/lib/php/pecl/20190902/xdebug.so: mach-o, but wrong architecture
        /opt/homebrew/lib/php/pecl/20190902/xdebug.so: stat() failed with errno=22), /opt/homebrew/lib/php/pecl/20190902/xdebug.so.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/xdebug.so.so, 9): image not found)) in Unknown on line 0

Warning: Failed loading Zend extension 'xdebug.so' (tried: /opt/homebrew/lib/php/pecl/20190902/xdebug.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/xdebug.so, 9): no suitable image found.  Did find:
        /opt/homebrew/lib/php/pecl/20190902/xdebug.so: mach-o, but wrong architecture
        /opt/homebrew/lib/php/pecl/20190902/xdebug.so: stat() failed with errno=22), /opt/homebrew/lib/php/pecl/20190902/xdebug.so.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/xdebug.so.so, 9): image not found)) in Unknown on line 0

我尝试从源代码(git clone git://github.com/xdebug/xdebug.git)重新编译 xdebug,结果相同。我可以config.m4在重新编译 xdebug 时强制使用正确的架构吗?- 还有其他建议吗?

4

4 回答 4

10

我需要指定架构。它适用于:

arch -arm64 sudo pecl install xdebug
于 2021-05-27T11:30:37.787 回答
0

尝试安装pecl install xdebug并收到此错误:

Build process completed successfully
Installing '/opt/homebrew/Cellar/php@7.4/7.4.15_1/pecl/20190902/xdebug.so'

Warning: mkdir(): File exists in System.php on line 294

Warning: mkdir(): File exists in /opt/homebrew/Cellar/php@7.4/7.4.15_1/share/php@7.4/pear/System.php on line 294
ERROR: failed to mkdir /opt/homebrew/Cellar/php@7.4/7.4.15_1/pecl/20190902

我使用了这个链接https://patriqueouimet.ca/tip/installing-php-and-pecl-extensions-on-macos的修复,它有帮助

您的警告是关于架构的,可能需要重新删除和安装 - 我是从 arm64 终端完成的......

于 2021-03-26T07:29:35.800 回答
0

您可能必须通过 PECL 安装 Xdebug:

arch -x86_64 sudo pecl install xdebug
于 2021-04-12T10:21:36.303 回答
0

不确定这是否是问题所在。但是,我完全重置了我的 M1 Macbook。而这次我只使用了arm软件(iterm,homebrew...),这次安装没有任何问题。

于 2021-04-16T06:21:11.033 回答