Home > Blockchain >  Xdebug is having trouble running on WSL Symfony server using PhpStorm
Xdebug is having trouble running on WSL Symfony server using PhpStorm

Time:12-17

I'm running a Symfony server with PHP7.3.33 & Xdebug 3.1.5 on a Debian Windows Sub-System Linux. I use PhpStorm on my Windows to code and I wanted to also use it to debug with Xdebug.

I had trouble to configure my Xdebug on my server but I managed to make it recognised by PhpStorm.

enter image description here

Then when I make a call to my server by loading a page, it stop on multiple files but not on my breakpoints. It also display me this error.

Cannot find a local copy of the file on the server /home/pierrem/.symfony5/php/4cddbar1067c22542bca91af1a7693a48ce69eea-router.php
Local path is //home/pierrem/.symfony5/php/4cddbar1067c22542bca91af1a7693a48ce69eea-router.php

The error I get on my PhpStorm

I've tried to fix this issue by opening the project from \\wsl$\Debian\home\XXXX and W:\home\XXXX but it changed nothing.

EDIT: I started the server using php -S localhost:8000 and the debugger is working but only in my index.

When i try to put a breakpoint on my controller, it will display with an error and no stop on this breakpoint:

File path is not mapped to any file path on server. Edit path mapping to fix the problem.

I tryed to update my PhpStorm servers config as follow but this is still not working.

enter image description here

CodePudding user response:

Thanks to @LazyOne and @Reynadan who helped me to make it work.

First in my case I needed to start the server by using the following command inside my project_name/public folder.

php -S localhost:8000

Then in PhpStorm I go to "PHP > Servers" and remove all my config entries.

I started a debug session where the only breakpoints I could use where in my index.php file because PhpStorm where not able to see outside the folder where I started my server. I then go back to my Servers config in PhpStorm (a new config app) and added an Absolute path for my project /home/pierrem/neocampus as follows (there where already the path of my /public/ folder but it's not needed because it is inherited from the parent.)

PhpStorm server config here

Now I can put breakpoints in my controllers.

  • Related