PHP7.1 + XDebug + WAMP + Visual Studio 代码问题

PHP7.1 + XDebug + WAMP + Visual Studio Code issues

我已经尝试了将近 2 天的工作设置。仍然没有运气。

问题:

在 Visual Studio 代码中,在我的项目中,一旦我单击指向 'Star Debugging' 的绿色箭头,然后我会转到带有本地网站的浏览器,然后刷新。 VSC 中没有任何反应。没有列出任何变量,none 我的断点做任何事情,等等。

我的环境:

X调试设置:

XDebug 在我的 php.ini 文件中显示为正确安装(使用 this 进行确认)。我为 XDebug 设置的当前设置:

; XDEBUG Extension
[xdebug]
zend_extension ="c:/wamp/bin/php/php7.1.16/zend_ext/php_xdebug-2.6.0-7.1-vc14.dll"

xdebug.remote_enable = on

xdebug.remote_autostart = on

xdebug.remote_connect_back = off

xdebug.remote_host = 127.0.0.1

xdebug.remote_port = 8080

xdebug.remote_log="c:/wamp/bin/xdebug/xdebug.log"

xdebug.idekey = VSCODE

VSC 设置:

在 VS 中,我将其作为我的 launch.json 文件:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 8080,
            "pathMappings": {
                "wamp/www/totara-10.0": "c:/",
            }    
        }
    ]
}

我在 xdebug 错误日志中遇到的错误是:

Log opened at 2018-04-02 16:19:22
I: Connecting to configured address/port: 127.0.0.1:8080.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///C:/wamp/www/totara-10.0/theme/image.php" language="PHP" xdebug:language_version="7.1.15-dev" protocol_version="1.0" appid="17712" idekey="VSCODE"><engine version="2.6.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2018 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 2018-04-02 16:19:22

我注意到 fileuri 正在显示 file:///,但是我在 VSC 中使用 pathMappings 进行的任何更改都没有显示任何变化。假设这是一个大问题,我看不出在哪里可以改变它。

我尝试了很多不同的调整,甚至 php 版本。我有 Google 并遵循了多个指南但没有运气(一个人在 Windows 上遇到问题并使用大写的 C:/)。因为我投入的时间是荒谬的,让我感到更加失败。

解法:

我不明白 XDebug 端口需要不同于本地 Apache Web 端口。以为这些应该是一样的。

默认端口 9000 在安装 IIS 时不起作用,因此只使用 9001。

已更改 xdebug.remote_port = 9001

和 Visual Studio 代码 "port": 9001

已解决问题。