Search code examples
debuggingbreakpointsxdebugphpstorm

How to show currently debugged line in PHPStorm?


Got remote debugging working in PHPStorm (version 6.0.2.) and every time execution stops on a breakpoint it shows me the current variables etc.

But it does not actually show me the file and line where the debugging has halted. I would expect the editor to jump to the file and highlight the line with the breakpoint that has just been reached. Can this be set by config somewhere, or it is like this by design?


Solution

  • I've found the answer. PHPStorm needs to be able to match the code repository file locations with those in the web root. Therefore we need to map them in the server settings of PHPStorm.

    I have been using a Quickstart virtual machine (https://drupal.org/project/quickstart) on a Windows PC. The repository is located on the PC but shared with the virtual machine.

    So it was debugging as I said but it kept saying "Remote file path ‘path/to/script/on/server.php’ is not mapped to any file path in project". I figured the problem of focussing on the currently debugged file and line might be related to mapping.

    In the server settings of PHPStorm I mapped the Windows root of the repository directory to the Linux web path in the virtual server (in my case /home/quickstart/websites/mysite.local) and that was apparently what confused the debugger... when I later used the mount path in Linux, thus the path to the shared location which is actually on the PC (in my case /mnt/vbox-shared/mysite.local), it and from that moment the file and line started to focus!