1

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

11
  • Please add the error message as text, not just an image. Commented Dec 13, 2022 at 17:04
  • 1
    Such a file ***-router.php seems to be generated on request / every time you make a change in your code. When the request comes in and you see that popup (on 2st screenshot), the IDE does not see that file (it shows no file option, only neocampus project). I'm not sure how it can be solved if the IDE does not do automatic "refresh" at that moment. I just know that using proper web server resolves that issue (as the request is not handled by Symfony's server then) Commented Dec 14, 2022 at 11:20
  • 1
    See this question and how the guy solved it. He had the same issue -- stackoverflow.com/questions/65326808/…. It's about this ***-router.php temp file that makes the whole thing to fail. Maybe you can disable creating them somehow (not using Symfony myself so cannot advise) Commented Dec 14, 2022 at 11:22
  • 1
    You last screenshot does not make any sense to me: the host should be just host name, not the port. The path mappings is the same - makes no sense to me. I may only suggest to delete ALL entries there, try to debug and let the IDE create one for you (will be done from that dialog that popups on the 1st screenshot). TBH I do not think it can be solved here (as per my link earlier). Not sure at all. Commented Dec 14, 2022 at 15:02
  • 1
    I suggest unchecking "Use path mapping" and here's how to fill the Debug server FYI i.imgur.com/JrXxJ8W.png Commented Dec 14, 2022 at 16:45

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Nice one. Glad you have made it working. I though it could not be done (based on past experience). It looks now that there were certain changes made since then + it may have been done something wrong in the first place (like you starting PHP server in the wrong folder).
P.S. There is no need for a separate mapping for public -- it is in the same folder (both local and remote) and therefore will be inherited just fine from the parent. Separate mapping can only be needed when the path differs (e.g. a symlink used etc)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.