问题描述
下午好.
当尝试在 PHP 8 上调试脚本时,PhpStorm 报告与版本 3 xdebug 没有连接.适用于 3 以下的所有版本.我尝试将 xdebug.remote_{host, port} 的参数更改为 xdebug.client_{host, port} 但也没有帮助.
Xdebug 3 将仅在 PhpStorm 2020.3 版本中得到全面支持,该版本目前处于 EAP 阶段(Early Access Program),并将在大约 1 个月后发布.
最近的 EAP #6 版本已经支持它:查看此博客文章了解更多信息:
从 IDE 启动的 CLI 调试(PHP 脚本"类型的配置):
IDE 正在执行:E:\Projects\php\php74\php.exe -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9001 -dxdebug.remote_host=127.0.0.1E:\Projects\web\_idetest\test.php
.如您所见,这些旧式参数根本不会影响 Xdebug 3.
附言如果我在 php.ini 中设置 xdebug.start_with_request = yes
那么调试甚至可以用于运行(或在 IDE 之外执行该 PHP 脚本时)——只要手机句柄"图标为绿色(IDE 侦听传入的调试请求).
Good afternoon.
When an attempt is made to debug the script on PHP 8, PhpStorm reports that there is no connection with version 3 xdebug. Works with all versions below 3. I tried to change the parameters of xdebug.remote_{host, port} to xdebug.client_{host, port} but also did not help.
Xdebug 3 will be fully supported in PhpStorm 2020.3 version only, which is currently in EAP stage (Early Access Program) and will be released in about 1 month time.
It is already supported in the most recent EAP #6 build: check this blog post for more info: https://blog.jetbrains.com/phpstorm/2020/11/phpstorm-2020-3-eap-6/
I have downloaded Xdebug 3.0.0beta1 for my PHP 7.4 on Windows 10, configured it from scratch (using correct Xdebug 3 config values: https://3.xdebug.org/docs/upgrade_guide and https://3.xdebug.org/docs/all_settings) ... and it still works fine in PhpStorm 2020.2.3.
Yes, IDE sends old-style parameters when initiating debugging for a CLI script (like xdebug.remote_{host, port}
etc) but the debug still works just fine.
This is my php.ini content for Xdebug 3 settings (as simple as this):
[xdebug]
xdebug.client_host = 127.0.0.1
xdebug.client_port = 9001
xdebug.mode = debug
(I have a bit mores settings, but those are customisation for output file names, log locations, extra stuff for quickly turn on some options in some scenarios/when needed etc -- these are not needed here and it works fine without them)
CLI debug initiated from IDE ("PHP Script" type of configuration):
That's what IDE is executing: E:\Projects\php\php74\php.exe -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9001 -dxdebug.remote_host=127.0.0.1 E:\Projects\web\_idetest\test.php
. As you may see these old style parameters do not affect Xdebug 3 at all.
P.S. If I set xdebug.start_with_request = yes
in php.ini then debug will work even for Run (or when executing that PHP script outside of IDE) -- as long as "phone handle" icon is green (IDE listens for incoming debug requests).
这篇关于与 PhpStorm 的连接未建立 Xdebug 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!