查看php适合哪个版本

我在这里是踩过坑的,始终不行,确定了php版本,是否线程安全,32位还是64架构,都对上了,但是还是不对。提示如下错误:

[23-Mar-2022 09:24:46 UTC] PHP Warning:  Failed loading Zend extension 'xdebug-3.1.3-7.4-vc15-x86_64' (tried: D:/laragon/bin/php/php-7.4.19-Win32-vc15-x64/ext\xdebug-3.1.3-7.4-vc15-x86_64 (找不到指定的模块。), D:/laragon/bin/php/php-7.4.19-Win32-vc15-x64/ext\php_xdebug-3.1.3-7.4-vc15-x86_64.dll (找不到指定的模块。)) in Unknown on line 0

文件位置及配置都没问题,但是一直报错。

正确的做法是,在命令行输入:

php -i > phpinfo.txt

拿到php的所有信息,然后把上面信息输入到方框中:
​​​https://xdebug.org/wizard​

windows下安装xdebug记录_php


结果我这边提示:

windows下安装xdebug记录_线程安全_02


瞬间感觉很坑爹,部分版本由于缺少组件,不能支持。。。

于是,我们需要换个版本的php。
​​​https://windows.php.net/download​

下载8.1版本和7.4.28版本,都下下来试试。

安装配置xdebug

换了版本以后,提示就很明晰拿了,需要下载那个版本的xdebug,怎么配置。

Installation Wizard
Summary
Xdebug installed: no
Server API: Command Line Interface
Windows: yes
Compiler: MS VC15
Architecture: x64
Zend Server: no
PHP Version: 7.4.28
Zend API nr: 320190902
PHP API nr: 20190902
Debug Build: no
Thread Safe Build: yes
OPcache Loaded: no
Extensions directory: D:\laragon\bin\php\php-7.4.28-Win32-vc15-x64\ext
Instructions
Download php_xdebug-3.1.3-7.4-vc15-x86_64.dll
Move the downloaded file to D:\laragon\bin\php\php-7.4.28-Win32-vc15-x64\ext, and rename it to php_xdebug.dll
Update D:\laragon\bin\php\php-7.4.28-Win32-vc15-x64\php.ini and add the line:
zend_extension = xdebug
Enabling Features
Now Xdebug is installed, you can enable its features. Please refer to the dedicated sections in the documentation about information on how to enable and configure these Xdebug features. Where these sections refer to php.ini or similar, please remember to use D:\laragon\bin\php\php-7.4.28-Win32-vc15-x64\php.ini:

Development Helpers — help you get better error messages and obtain better information from PHP's built-in functions.
Step Debugging — allows you to interactively walk through your code to debug control flow and examine data structures.
Profiling — allows you to find bottlenecks in your script and visualize those with an external tool.

windows下安装xdebug记录_线程安全_03

写入配置:

zend_extension = xdebug

[xdebug]
xdebug.remote_enable= 1
xdebug.remote_autostart = 1

检查拓展安装是否ok

php -m | grep xdebug

windows下安装xdebug记录_phpstorm_04


至此,xdebug安装正常。