在Ubuntu中将VSCode与PHP(7)调试器一起使用

时间:2019-11-01 14:00:04

标签: php visual-studio-code vscode-debugger

我在Ubuntu中使用VSCode来处理php项目。我使用php调试器扩展(和xdebug)工作得很好,但是现在突然停止了工作。 (无更新,配置无变化。只是一台简单的重启计算机)。确切的问题是VSCode不会在代码的断点处停止。

Netbeans与xdebug配合使用非常好,所以我不知道是什么原因导致VSCode出现此问题。

我应该尝试的任何提示或想法吗?

谢谢。

我已经更改了运行xdebug的端口,尝试从Internet尝试使用不同的launch.json,但不知道发生了什么。我最近激活了log选项,并且从vscode获得了一些有关“格式错误的HTTP请求”的输出,我想这是一个线索。

这是我的launch.json文件,具有我设置的配置。 (xdebug位于php.ini文件中的9090端口上)

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [        
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9090,
            "log": true
        },
        {
            "name": "Launch server",
            "type": "php",
            "request": "launch",
            "program": "${workspaceRoot}/site/index.php",
            "runtimeExecutable": "php",
            "runtimeArgs": [
                "-dzend_extension=/usr/lib/php/20170718/xdebug.so",
                "-S",
                "0.0.0.0:9090"
            ],
            "cwd": "${workspaceRoot}",
            "port": 9090,
            "log" : true
        }
    ]
  }

VSCode日志的输出:

<- launchResponse
Response {
  seq: 0,
  type: 'response',
  request_seq: 2,
  command: 'launch',
  success: true }

<- outputEvent
OutputEvent {
  seq: 0,
  type: 'event',
  event: 'output',
  body:
   { category: 'stderr',
     output:
      '[Fri Nov  1 10:50:06 2019] 127.0.0.1:49922 Invalid request (Malformed HTTP request)\n' } }

1 个答案:

答案 0 :(得分:0)

这很尴尬,但我使用CTROL + F5而不是仅使用F5(我曾经在Visual Studio中使用)执行iDE。

那是整个问题...

谢谢!