Search code examples
visual-studio-codevagrantxdebughomesteadxdebug-3

Problem Running XDebug 3.x on Laravel/Homestead Vagrant


I need help regarding with my Homestead configuration. Currently I'm running a development project using Laravel/Homestead that running over VirtualBox Vagrant. I'm installed PHP 8.0.2 and Xdebug 3.0.2 and ZendOpCache v 8.0.2 But unfortunately I cannot connect my VSCODE that installed on my Windows (Both IDE and Homestead are installed on Windows)

My Homestead IP Address is 192.168.56.17 and the host is 192.168.56.1

Here is my XDebug configuration and I put the xdebug.ini on /etc/php/8.0/cli/conf.d/20-xdebug.ini

zend_extension = xdebug.so
xdebug.mode = debug
xdebug.idekey = VSCODE
xdebug.max_nesting_level = 512
xdebug.start_with_request = yes
xdebug.client_port = 9003
xdebug.client_host = 192.168.56.1

And here is my VSCODE launch.json

{
    // 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": 9003,
            "stopOnEntry": false,
            "log": true,
            "pathMappings": {"/home/vagrant/code/project" : "${workspaceRoot}"}
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9003
        }
    ]
}

Kindly need help regarding this


Solution

  • your problem is

    xdebug.start_with_request = yes
    

    just delete it and you will get your Xdebug working

    BTW, after deleting it, restart you FPM like so

    $ sudo service php7.4-fpm restart
    

    and restart your browser and IDE