【问题标题】:Connection was not established Xdebug 3 with PhpStorm未与 PhpStorm 建立连接 Xdebug 3
【发布时间】:2021-02-25 08:48:09
【问题描述】:

下午好。

当尝试在 PHP 8 上调试脚本时,PhpStorm 报告与版本 3 xdebug 没有连接。适用于 3 以下的所有版本。我尝试将 xdebug.remote_{host, port} 的参数更改为 xdebug.client_{host, port} 但也没有帮助。

【问题讨论】:

  • 你的 IDE 版本到底是什么?
  • PhpStorm 2020.2.3
  • Xdebug 3 将仅从 PhpStorm 2020.3 版本开始支持,该版本目前处于 EAP 阶段(Early Access Program),将在大约 1 个月的时间内发布。见stackoverflow.com/a/64777506/783119
  • 我安装了 PhpStorm 2020.3,发现 PhpStorm 2020.2 没有添加一些标志,导致连接不工作

标签: php phpstorm xdebug php-8


【解决方案1】:

Xdebug 3 将仅在 PhpStorm 2020.3 版本中得到全面支持,该版本目前处于 EAP 阶段(Early Access Program),将在大约 1 个月后发布。

最新的 EAP #6 版本已经支持它:查看这篇博文了解更多信息:https://blog.jetbrains.com/phpstorm/2020/11/phpstorm-2020-3-eap-6/


我已经在 Windows 10 上为我的 PHP 7.4 下载了 Xdebug 3.0.0beta1,从头开始配置它(使用正确的 Xdebug 3 配置值:https://3.xdebug.org/docs/upgrade_guidehttps://3.xdebug.org/docs/all_settings)... 它仍然可以正常工作PhpStorm 2020.2.3.

是的,IDE 在启动 CLI 脚本调试时会发送旧式参数(如 xdebug.remote_{host, port} 等),但调试仍然可以正常工作。

这是我的 Xdebug 3 设置的 php.ini 内容(就这么简单):

[xdebug]
xdebug.client_host = 127.0.0.1
xdebug.client_port = 9001
xdebug.mode = debug

(我有更多的设置,但这些是针对输出文件名、日志位置、在某些情况下/需要时快速打开某些选项等的额外内容的自定义——这里不需要这些,它没有它们也可以正常工作)

从 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.1 E:\Projects\web\_idetest\test.php。正如您所见,这些旧式参数根本不会影响 Xdebug 3。

附:如果我在 php.ini 中设置了xdebug.start_with_request = yes,那么即使运行(或在 IDE 之外执行 PHP 脚本时)也可以进行调试——只要“电话句柄”图标为绿色(IDE 侦听传入的调试请求)。

【讨论】:

  • 刚才忘记改php.ini了,还以为conf.d/20-xdebug.ini的改会连上
猜你喜欢
  • 2023-02-05
  • 2013-01-13
  • 2019-08-04
  • 2018-04-27
  • 2019-08-05
  • 1970-01-01
  • 2015-09-25
  • 2010-12-29
  • 2021-03-15
相关资源
最近更新 更多