VSCode +远程-Firefox的SSH + VS代码调试器,如何?

时间:2019-09-20 09:48:18

标签: firefox visual-studio-code remote-debugging vscode-debugger vscode-remote

因此,我正在尝试播放vscode-firefox-debug

vscode-firefox-debug声称与vscode remote兼容。

我如何配置此东西以与遥控器配合使用?

我所有的开发都是在运行Slackware64 14.2的远程无头服务器上完成的

我们叫那个盒子www.example.com

我的本​​地邮箱是Windows 8.1 x64 Pro,其中:

Firefox 69.0.1 (64-bit)

Visual Studio Code
Version: 1.38.1 (system setup)
Commit: b37e54c98e1a74ba89e03073e5a3761284e3ffb0
Date: 2019-09-11T13:35:15.005Z
Electron: 4.2.10
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 6.3.9600

我使用"C:\Program Files\Mozilla Firefox\firefox.exe" -start-debugger-server

运行firefox

我已经设置了Remote-SSH和朋友,并且可以与vscode-php-debugXDebug很好地工作。

添加到远程服务器上的launch.json。我尝试了一些变体:

第一次尝试

    {
      "name": "Launch localhost",
      "type": "firefox",
      "request": "launch",
      "reAttach": true,
      "url": "http://localhost/index.html",
      "webRoot": "${workspaceFolder}"
    },

First launch config

第二次尝试

    {
      "name": "Attach localhost",
      "type": "firefox",
      "request": "attach",
      "url": "http://localhost/index.html",
      "webRoot": "${workspaceFolder}"
    },

First attach config

第三次尝试

    {
      "name": "Launch index.html",
      "type": "firefox",
      "request": "launch",
      "reAttach": true,
      "port": 6000,
      "file": "${workspaceFolder}/index.html",
      "url": "https://www.example.com/index.html",
      "webRoot": "${workspaceFolder}"
    },

并且我在调试控制台中收到了通知,说:

Firefox can't open a file in a remote workspace

最后一次尝试

    {
      "name": "Attach index.html",
      "type": "firefox",
      "request": "attach",
      "port": 6000,
      "url": "https://www.example.com/",
      "webRoot": "${workspaceFolder}"
    },

Another failed attempt

1 个答案:

答案 0 :(得分:1)

点击链接为您提供帮助:

https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug

在服务器上运行以手动启动xdebug的示例,而通过SSH调试时,本地VS代码IDE上的文件为:

$ php -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host=127.0.0.1 -dxdebug.remote_connect_back=1 /var/www/html/teste.php