Xdebug VSCode忽略断点

时间:2019-03-15 16:39:14

标签: visual-studio-code xdebug

我正在使用VSCode和Docker。经过研究,我意识到了这些步骤:

  1. 在Docker上安装和配置Xdebug(也是Xdebug日志文件)
  2. 为VSCode安装Xdebug扩展
  3. 在launch.json中修改配置

现在,如果我在浏览器上打开简单的“ test.php”脚本,则调试器不会在我的断点处中断,此外,我在启动时设置了标志中断,这些也被忽略了。有人给我提示吗?

我的launch.json文件:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "stopOnEntry": true,
            "port": 9000,
            "pathMappings": {
                "/var/www/html": "/Users/MYUSERNAME/calc/"
              },
              "log": true
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "stopOnEntry": true,
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        }
    ]
}

Xdebug.log

[7] Log opened at 2019-03-15 16:32:32
[7] I: Checking remote connect back address.
[7] I: Checking header 'HTTP_X_FORWARDED_FOR'.
[7] I: Checking header 'REMOTE_ADDR'.
[7] I: Remote address found, connecting to MYIP:9000.
[7] I: Connected to client. :-)
[7] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/html/web/index.php" language="PHP" xdebug:language_version="7.0.27" protocol_version="1.0" appid="7" idekey="www-data"><engine version="2.7.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2019 by Derick Rethans]]></copyright></init>
[7]
[7] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>
[7]
[7] Log closed at 2019-03-15 16:32:33

启动响应表vscode

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

php-fpm使用的端口9000现在我使用端口9001,但是xdebug日志显示未成功连接到客户端

[7] Log opened at 2019-03-15 17:26:20
[7] I: Checking remote connect back address.
[7] I: Checking header 'HTTP_X_FORWARDED_FOR'.
[7] I: Checking header 'REMOTE_ADDR'.
[7] I: Remote address found, connecting to MYIP:9001.
[7] W: Creating socket for 'MYIP:9001', poll success, but error: Operation now in progress (29).
[7] E: Could not connect to client. :-(
[7] Log closed at 2019-03-15 17:26:20
[7]

我也更改了vscode中launch.json中的端口。 顺便说一下,我在Mac上安装了所有内容。


现在,我解决了我的问题。我禁用“ remote_connect_back”并将本地IP设置为“ remote_host”。现在可以了。

0 个答案:

没有答案