[英]PHP - installing Xdebug on Mac with XAMPP (Unix File)
I have a trouble installing Xdebug on my PHP project.我在 PHP 项目上安装Xdebug时遇到问题。 I am on macOS Monterey M1 and I am using XAMPP for launching project on PHP version 7.4.28.
我在 macOS Monterey M1 上,我正在使用XAMPP在 PHP 版本 7.4.28 上启动项目。
I followed the instructions given on their official webpage:我按照他们官方网页上的说明进行操作:
Download xdebug-3.1.4.tgz
Run: cd xdebug-3.1.4
Run: phpize (See the FAQ if you don't have phpize).
Run: ./configure
Run: make
Run: cp modules/xdebug.so /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20190902
Update /Applications/XAMPP/xamppfiles/etc/php.ini and add the line:
zend_extension = xdebug
When typing php -v
in my terminal I first get few errors like:在我的终端中键入
php -v
时,我首先会遇到一些错误,例如:
HP Startup: Unable to load dynamic library 'php_soap.dll' (tried: /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20190902/php_soap.dll
惠普启动:无法加载动态库“php_soap.dll”(已尝试:/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20190902/php_soap.dll
I tried following the path and I saw that in the specific folder there is Unix Executable File and not the folder with added files..我尝试按照路径进行操作,发现在特定文件夹中有Unix 可执行文件,而不是包含添加文件的文件夹。
How can I bypass this?我怎样才能绕过这个? I know XAMPP is not the best solution for Mac, but I see that it has been used by others.
我知道 XAMPP 不是 Mac 的最佳解决方案,但我看到它已被其他人使用。
Finally solved it and for everyone having the same issue:终于解决了它,对于每个有同样问题的人:
On M1, your PHP can either be compiled for the x86_64 or arm64 architectures.在 M1 上,您的 PHP 可以针对 x86_64 或 arm64 架构进行编译。 The pecl tool can't guess which one it is, so if your PHP is compiled with say x86_64 and the default compiler setting is arm64, then you'll get the above warning.
pecl 工具无法猜测它是哪一个,因此如果您的 PHP 是使用 x86_64 编译的并且默认编译器设置为 arm64,那么您将收到上述警告。 This means, that sometimes you have to run PECL with:
这意味着,有时您必须使用以下命令运行 PECL:
arch -x86_64 sudo pecl install xdebug
The arch -x86_64 part will set up the environment to compile Xdebug as x86_64 binary. arch -x86_64 部分将设置环境以将 Xdebug 编译为 x86_64 二进制文件。
Thank you all for suppоrt!谢谢大家的支持!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.