繁体   English   中英

VSCodium (VSCode) 不开始调试 PHP (PHP Debug + Xdebug, Linux)

[英]VSCodium (VSCode) doesn't start debugging PHP (PHP Debug + Xdebug, Linux)

目标
使用PHP Debug 、 Xdebug 和 VSCodium 进行调试

问题

VSCode 不会开始调试。 当我单击Start Debugging ,调试控制按钮下方的蓝线出现并移动几秒钟,然后控制按钮消失。 当我按下绿色的“运行”按钮时相同

phpdebugvscode1

同样在左侧,“变量”、“观察”和“堆栈”没有显示。

描述
我对 VSCodium 调试选项没有经验。 我用了几个教程(的123 ,视频和肯定试图从VSCode PHP调试扩展网站的建议(我使用)。我使用的刺松( VSCode没有MS一个Linux Mint的20台计算机上)。PHP 7.4 和 Xdebug 是通过 Linux Synaptic Package Manager 安装的。当然 Firefox 中的 Xdebug helper 是启用的,设置了断点,我在不同的项目中尝试过。我在php.ini尝试了一些东西。这就是现在的样子:

[XDebug]
xdebug.remote_enable = 1
; xdebug.remote_autostart = 1
; xdebug.remote_connect_back = 1

Xdebug 本身是通过/etc/php/7.4/cli/conf.d/20-xdebug.ini加载的,在 PhpStorm 中它按预期工作,但在 VSCodium 中则不然。

这是标准的launch.json ,它保存在项目根目录的.vscode文件夹中:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Listen for XDebug",
      "type": "php",
      "request": "launch",
      "port": 9000,
      "log": true
    },
    {
      "name": "Launch currently open script",
      "type": "php",
      "request": "launch",
      "program": "${file}",
      "cwd": "${fileDirname}",
      "port": 9000
    }
  ]
}

这是我的phpinfo()输出的一部分:

phpinfo1

和 xdebug 部分:

在此处输入图片说明

在此处输入图片说明

这里是我使用 VSCodium 尝试时的 xdebug 日志:

[5625] Log opened at 2020-10-04 10:05:20
[5625] I: Connecting to configured address/port: localhost:9000.
[5625] W: Creating socket for 'localhost:9000', poll success, but error: Operation now in progress (29).
[5625] E: Could not connect to client. :-(
[5625] Log closed at 2020-10-04 10:05:20

我的猜测是,有一个基本的 VSCodium 调试功能,我没有启用左右。 但我不知道,它可能是什么。 也许有人有想法?

终于找到了解决办法。 它是Codium特定的错误。 在 VSCode 它有效。 在这里找到解决方案: https : //github.com/VSCodium/vscodium/issues/466

  1. 确保你没有安装 PHP 调试扩展;

  2. 转到https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug并使用“资源”→“下载扩展”下载 vsix 文件;

  3. 在 VSCodium 中,转到“扩展”侧边栏,然后单击“扩展”标题附近的三个点图标;

  4. 选择“从 VSIX 安装...”并选择下载的文件。

@LazyOne 再次感谢您的帮助:)

编辑

如果您更新到 Xdebug 3.*,则必须修改php.ini的 xdebug 部分:

添加这个:

xdebug.mode=debug
xdebug.client_host=127.0.0.1
xdebug.client_port=9000

如果在launch.json端口更改为 9003,则可以删除最后一行。

另请参阅此GitHub 问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM