【问题标题】:Cannot setup Xdebug in VSCode on XAMPP on Linux Mint无法在 Linux Mint 上的 XAMPP 上的 VSCode 中设置 Xdebug
【发布时间】:2021-03-28 18:13:06
【问题描述】:

这是我的设置:

在 xampp 中找到的 php.ini:/opt/lampp/etc/php.ini

[XDebug]
zend_extension=/usr/lib/php/20180731/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_autostart = 1

这就是 phpinfo() 的样子:

我无法单步执行代码,甚至无法使用推荐的 PHP Debug 插件设置断点。

这是 VSCode 的默认 launch.json。

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

【问题讨论】:

  • 嗨@jessiPP,这里可能还有更多内容。为了争论,当你运行 phpinfo() 时,它是否显示 xdebug 已加载?
  • @jessiPP 您在使用 Xdebug v3 的同时拥有 Xdebug v2 配置参数。它们现在不同了(只需检查您自己的屏幕截图上的消息——它会告诉链接在那里进行检查)。在任何情况下:查看 Xdebug 升级指南 (xdebug.org/docs/upgrade_guide) 并调整您的配置。同类票:stackoverflow.com/a/65350070/783119, stackoverflow.com/a/65141934/783119

标签: php linux visual-studio-code xampp xdebug


【解决方案1】:

我在您的 phpInfo() ss 中看到 xdebug 的端口设置为 9003,而您的 launch.json 正在侦听端口 9000。也许这就是问题所在?

【讨论】:

    猜你喜欢
    • 2013-08-02
    • 2012-09-16
    • 2023-03-04
    • 2014-01-01
    • 2019-11-10
    • 1970-01-01
    • 2021-03-14
    • 2013-07-02
    • 2018-10-12
    相关资源
    最近更新 更多