我已在 Windows 11 上安装 PHP v8.2.12 作为 XAMPP 安装的一部分。
使用 Xdebug 向导使用返回的
phpinfo();
的输出来确定我需要哪个二进制文件:
Summary
Xdebug installed: no
Server API: Apache 2.0 Handler
Windows: yes
Compiler: MS VS16
Architecture: x64
Zend Server: no
PHP Version: 8.2.12
Zend API nr: 420220829
PHP API nr: 20220829
Debug Build: no
Thread Safe Build: yes
OPcache Loaded: no
Configuration File Path: no value
Configuration File: C:\xampp\php\php.ini
Extensions directory: C:\xampp\php\ext
Instructions
Download php_xdebug-3.3.1-8.2-vs16-x86_64.dll
Move the downloaded file to C:\xampp\php\ext, and rename it to php_xdebug.dll
Update C:\xampp\php\php.ini and add the line:
zend_extension = xdebug
Restart the Apache Webserver
做了所有这些事情,并尝试使用
php --version
来查看它是否安装正确,它返回:
PHP Warning: Can't load module 'C:\xampp\php\ext\php_xdebug.dll' as it's linked with 2.25, but the core is linked with 14.29 in Unknown on line 0
经过大量谷歌搜索后,我想我已经发现我的 PHP 和 Xdebug 编译不兼容(参见here)。问题是我不知道如何在 Windows 上从源代码编译 Xdebug(请参阅 GitHub 文档),我也不能 100% 确定这实际上是问题所在。有什么想法吗?
必须从下载页面重新下载 dll,而不是通过向导上给我的链接。