Can't get Xdebug to work

Hi @texnixe,
I tried to follow your recipe on setting up Xdebug, but unfortunately, I cannot get it to do anything in VS Code. Here is the part where I’m stuck

Next, open the notes page of the Starterkit in your browser. If all went well, you will be switched back to the VS Code editor, with the formerly empty debug panel now filled with information.

Well, I open starterkit.test/notes in my browser, but I am not switched back to VS Code and the debug panel is not filled with information. Also, my bar on the bottom is orange, not blue (or is this maybe just a version control thing?).

20210108-023445_Screenshot_Code

Any idea, why this fails for me at this point? Is there any additional info I could give you to help figure this out?

Thanks!

Have you added the settings in PHP.ini and restarted the server?

Yes and yes.

My php.ini entries look like that:

zend_extension="xdebug.so"
xdebug.mode=debug
xdebug.start_with_request = yes
xdebug.client_port = 9003
xdebug.client_host = localhost
xdebug.idekey = VSCODE

Is the first line correct? It was automatically generated by the xdebug installation like this. Also, all these lines sit at the very top of the php.ini file. Is this also correct?

And you have set the correct port in launch.json as well? Make sure nothing else is running on that port.

What is your dev environment? Running Laravel Valet?

1 Like

Yes, I am running Laravel Valet, my launch.json looks 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": 9003
    },
    {
      "name": "Launch currently open script",
      "type": "php",
      "request": "launch",
      "program": "${file}",
      "cwd": "${fileDirname}",
      "port": 9003
    }
  ]
}

As the article states that 9003 is the default port, I assumed I should use that one. Is it possible that Laravel Valet uses something else? How can I find out if port 9003 is used otherwise?

I am on Mac OS 10.13.6.

Yes, port 9003 is fine.

Valet runs on port 9000, so no issue with that conflicting.

Have you tested in multiple browsers?

1 Like

Ha, got it to work now: I rebooted my Mac, now it works. :man_facepalming:

But I did restart the php server earlier, so I am pretty sure that was not the problem. Anyways, it works now. Thanks, @pixelijn for helping me!

@texnixe, one more remark: In the recipe there is this line:

In site/models/note.php remove or uncomment the cover() function

which should probably be

In site/models/note.php remove or comment out the cover() function

Oh yes, will fix.