VSCode and Xdebug on a Laravel Lighthouse Windows environment setup

333 Views Asked by At

I'm trying to set up Xdebug to work in VSCode on a Windows environment with a Lighthouse / Laravel based server. My VSCode settings look like this

{
    // 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": 9000
        },

        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        }
    ]
}

I've also tried adding a pathMappings to there with no luck

"pathMappings": {
            "/graphql": "${workspaceRoot}/public"
        }

I've followed https://laracasts.com/series/visual-studio-code-for-php-developers/episodes/13 and added all there suggested configurations. When I type php -v

PHP 7.4.10 (cli) (built: Sep  1 2020 16:52:21) ( NTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Xdebug v3.0.0, Copyright (c) 2002-2020, by Derick Rethans

I do see Xdebug installed. My php.ini looks like this

[XDebug]
zend_extension = "php_xdebug-3.0.0-7.4-vc15-nts-x86_64.dll"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 1
xdebug.remote_host=localhost
xdebug.idekey=VSCODE
xdebug.remote_log ="C:\tools\xdebug.log"

Any advice would be greatly appreciated

1

There are 1 best solutions below

1
On

For anyone else with a similar problem just needed to upgrade my php.ini.

[XDebug]
zend_extension = "php_xdebug-3.0.0-7.4-vc15-nts-x86_64.dll"
xdebug.mode = debug
xdebug.start_with_request=yes
xdebug.idekey=VSCODE

Ended up something like this not even sure if the idekey is even necessary now. That and change the port to 9003 as that changed in version 3 apparently.