xdebug 扩展未在 mac 上的 xampp 中加载 - x86_64 与 arm64

问题描述 投票:0回答:1

我按照 xdebug.org 上的说明在我的 m2 mac 上安装 xdebug。 为了编译扩展,我在我的机器上安装了 php,所以我安装了最新的 8.2 我还使用 pecl 和 -arm64 安装了 xdebug (对于我的 M2,如文件

which php
所示),并且当我尝试 php -v 时它会加载 但在 xampp 上,我似乎安装了另一个 php,它是 8.1,正如它在本地主机上的 phpinfo() 中所说的那样。 我使用 xdebug.org/wizard 上的 8.1 localhost-phpinfo 创建的扩展(显然使用系统 8.2 进行编译)已就位。 当我检查 /Applications/XAMPP/xamppfiles/bin/php 时,它显示了扩展未加载的原因:

Failed loading /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so:  dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so, 0x0009): tried: '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

那里说需要“x86_64”,尽管我的Mac是M2,所以是arm64。有没有可能我的xampp中有x86_64 php,而我的系统php中有arm64 php? 如何获得合适的 xdebug-3.2.2.tgz? 或者我应该重新安装 xampp 并希望使用arm64 php 8.2?

我迷路了。

macos xampp xdebug xdebug-3
1个回答
0
投票

有没有可能我的系统php中有xampp中的x86_64 php和arm64 php?

是的,很有可能。据我了解,XAMPP 仍然是

x86_64
,原生 PHP 是
arm64

如何获得合适的xdebug-3.2.2.tgz?

源代码适用于两者。从源代码创建的二进制文件需要是任一变体。

或者我应该重新安装 xampp 并希望使用arm64 php 8.2?

这应该可以解决问题。或者甚至使用他们的新版本 8.1.17。他们的网站称“它支持 intel (x64) 或 Apple M1 (arm64) CPU”。我无法验证这一点,因为我没有 macOS。

或者,您可以使用:

  • arch -x86_64 sudo pecl install -f xdebug
    创建 intel/x64
    xdebug.so
    并将其复制到
    /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so
    以便安装 XAMPP
  • 使用
    arch -arm64 sudo pecl install -f xdebug
    为您的本机 PHP 重新安装 Xdebug。后者会覆盖第一个创建的。 PECL 需要
    -f
    标志才能允许这样做。
© www.soinside.com 2019 - 2024. All rights reserved.