Xdebug(在Vagrant上)不适用于VSCode

时间:2019-10-12 21:12:26

标签: php ubuntu visual-studio-code vagrant xdebug

我有一堆Vagrant + Ubuntu。除Xdebug外,其他所有功能都可以正常工作。

流浪文件:

config.vm.network "private_network", ip: "192.168.33.10"
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "forwarded_port", guest: 9000, host: 9000

xdebug.ini:

xdebug.remote_enable=1
xdebug.remote_host=192.168.33.10
xdebug.remote_port=9000
xdebug.remote_connect_back=1
xdebug.remote_autostart=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_log=/var/www/project.local/.xdebug/xdebug.log

launch.json(在VSCode上):

{
    "version": "0.2.0",
    "configurations": [

        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "pathMappings": {
                "/var/www/project.local": "${workspaceFolder}"
            },
            "port": 9000,
            "log": true
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        }
    ]
}

当我尝试开始跟踪时,会获得日志条目:

Log opened at 2019-10-12 19:41:07
I: Checking remote connect back address.
I: Checking header 'HTTP_X_FORWARDED_FOR'.
I: Checking header 'REMOTE_ADDR'.
I: Remote address found, connecting to 192.168.33.1:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/project.local/index.php" language="PHP" xdebug:language_version="7.0.4-5ubuntu1" protocol_version="1.0" appid="16347" idekey="vagrant"><engine version="2.4.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2016 by Derick Rethans]]></copyright></init>

-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>

Log closed at 2019-10-12 19:41:07

断点不起作用,跟踪没有开始。我在做什么错了?

0 个答案:

没有答案