首页 > 解决方案 > 在 VSCode 中,我无法让 PHP 调试器正常运行

问题描述

我正在尝试为我的工作数据库创建一个新报告。尝试在 Windows 10 上的 VSCode 中调试 PHP,在本地机器上运行 XAMPP。该站点位于 vue.js 中,带有连接到 mysql 5.7 数据库的 php api。我对 \khcc2\NETFOLDERS\UserName\htdocs\crm 中的 crm 使用 npm run dev 并需要调试 report.class.php api。

在 php.ini 中

    [XDebug]
    zend_extension = C:\tempx\xampp\php\ext\php_xdebug-2.7.1-7.3-vc15-x86_64.dll
    xdebug.remote_enable = 1
    xdebug.remote_autostart = 1
    xdebug.remote_host = localhost
    xdebug.idekey = "vscode"
    xdebug.remote_port = 9000

在 api 我有 launch.json

"configurations": [
    {
        "name": "Listen for XDebug",
        "type": "php",
        "request": "launch",
        "port": 9000,
    }

我已经尝试添加到 launch.json 中的每一个(不是一次全部):

    "cwd": "\\\\khcc2\\NETFOLDERS\\UserName\\htdocs\\api",
    "cwd": "h:\\htdocs\\api",
    "cwd": "${workspaceRoot}",

我仍然得到:无法打开'index.php':找不到文件(file:///h:/htdocs/api/NETFOLDERS/UserName/htdocs/api/index.php)。

标签: phpwindowsvisual-studio-codexdebugunc

解决方案


推荐阅读