PHP debugging: absolute vs. relative file paths

Hi,

after waiting some time I'm giving the PHP debugger another try. I just downloaded 9.0.1  and things are looking better now (yay!) but I still have a hopefully minor configuration problem that I can't figure out:

  • My project files are located at /Applications/XAMPP/xamppfiles/htdocs/myproject/trunk/
  • I have a module that points to /Applications/XAMPP/xamppfiles/htdocs/myproject/trunk/ so if I e.g. open the file /Applications/XAMPP/xamppfiles/htdocs/myproject/trunk/xy.php, the path that will be displayed in the window title bar is ".../xy.php".
  • In my debug configuration, I have set "Local path on client" to "/Applications/XAMPP/xamppfiles/htdocs/myproject/trunk/" and "Local path on server" to "/" (which was essential to get things working as well as they are now - but maybe I'm missing something?)


When I navigate to the file xy.php, I of course end up in ".../xy.php". The problem is: when I set a breakpoint in this file and then start the debugger, it stops at the breakpoint in the correct line but the file that is displayed is located at /Applications/XAMPP/xamppfiles/htdocs/myproject/trunk/xy.php instead of .../xy.php (which is the same file, Idea just handles them as two different files and displays them in two separate tabs).

Some of the negative side effects of this are that

  • the breakpoints are not visible in the file (although the debugger stops at the correct line) which means I can not remove them while debugging
  • when I try to edit the content of the file, the changes are not synched to ../xy.php and from prior experience I assume that I'm only asking for trouble if I try to edit the file and then force a resynchronization
  • "Autoscroll to source" is of course not working since Idea thinks the file is not part of my project tree



I'm very glad that I got things working this far but if this could be fixed, it would be perfect. I tried various configuration options but maybe I just missed something (maybe I have to add something else as a module, external library or something like that?)


Carina

1
7 comments

Hello Carina,

If your sever is running on the same machine as IDEA, you don't need debug mappings at all, since 'local path on client' is just the same as 'local path on server'. ('Local path on XXX' means 'an absolute path on the filesystem of XXX').

If that does not help, please provide debugger logs (the same way as you did before, but now logs were moved to ~/Library/Logs/IntelliJIdea90.

Also please be aware of the symlinks-related issue: http://youtrack.jetbrains.net/issue/WI-600.

Regards,
Kirill

0

Hi Kirill,



thanks again for your reply.

ks wrote:

If your sever is running on the same machine as IDEA, you don't need debug mappings at all, since 'local path on client' is just the same as 'local path on server'.


When I remove the mapping, the debugger will not stop at the breakpoints that I set in ../xy.php. When I add the mapping, it will at least stop in /absolutepath/xy.php but without displaying the breakpoints and without realizing that these two files are indeed the same file. I attached two log files, one with the mapping and one without the mapping. You might notice that the request is sent to http://myprojecttest.com but this is simply mapped to my localhost and the behavior is the same if I do use localhost instead.
--



Thanks for pointing out the symlink-reated issue! I think this is exactly the problem that I'm having. And it seems I'm not the only one who needs the local/server mapping to make this work:
Nishi

21 Jan 2010 16:47: I finally succeeded to setup debugging to work reliably enough, I just played with "Debug path mappings".

21st of January? Maybe I inspired him
--


About the current workaround:

short_path as local <-> canonical_path (symlink evaluated) as server.


I set my server's document root to htdocs/myproject/trunk instead of htdocs so I assume my mapping (local: "/Applications/XAMPP/xamppfiles/htdocs/myproject/trunk/"  server: "/") does already do what this workaround suggests. Is this correct?


If there is nothing else that I can do, I will just wait. As long as I know that there is already a bug posted and it is regarded as a major one and will thus hopefully be fixed soon (keeping my fingers crossed!) I'm happy and looking forward to the fix. I have waited years for this, a couple of weeks won't hurt - it will be SO worth it :-)


Carina


Attachment(s):
idea_without_mapping.log.zip
idea_with_mapping.log.zip
0

Hello Carina,

Second log contains the traces of local variables evaluation, but to my regret it starts a bit later than the trace that shows the file path of the hit breakpoint is printed.

In the same time I see form the handshake trace that the canonical path of the retrieved file is '/Applications/XAMPP/xamppfiles/htdocs/myproject/trunk/public/index.php' (note the 'public' folder in the middle). Assuming it corresponds to the .../index.php in your project, I suggest to try the following mapping:

local path: /Applications/XAMPP/xamppfiles/htdocs/myproject/trunk/index.php
server path: /Applications/XAMPP/xamppfiles/htdocs/myproject/trunk/public/index.php

I set my server's document root to htdocs/myproject/trunk instead of htdocs so I assume my mapping (local: "/Applications/XAMPP/xamppfiles/htdocs/myproject/trunk/"  server: "/") does already do what this workaround suggests. Is this correct?


Unfortunately not. 'Local path on server' does not relate to URLs relative to web server document root. This is just canonical (symlinks resolved) path of the file in the file system of the machine web server is running on, such as the paths you operate when you're working in Terminal on that machine.

Regards,
Kirill

0

Hi Kirill,

'Local path on server' does not relate to URLs relative to web server document root. This is just canonical (symlinks resolved) path of the file in the file system of the machine web server is running on, such as the paths you operate when you're working in Terminal on that machine.


Aaaaaah, now I got it, thank you SO much for the explanation. It is finally working in exactly the way I want it to. You just made my day (or rather my month or year! ).

The "public" folder was not the problem - this is my servers document root that contains mostly static files (js, css) and the first index.php. Most of the other php files are in another folder. What I needed to do is resolve the symlink that XAMPP uses for it's htdocs folder:

local path: /Applications/XAMPP/htdocs/myproject/trunk/
server path: /Applications/XAMPP/xamppfiles/htdocs/myproject/trunk/



As an alternative, it might also have helped if I changed my module settings to point to the "real" path instead of the symlinks.


Again: thank you! I think this will be my favorite innovation of 2009/2010. Uninstalling Eclipse right now. Finally.


Regards,
Carina
0

Hello Carina,

What I needed to do is resolve the symlink that XAMPP uses for it's htdocs folder:

You're right and I actually overlooked this (rather usual for XAMPP) setup I should deduce from the logs.

Anyway thanks for finding this out and congratulation on getting it solved! [or worked-around for the moment]

Please watch for the issue, we're going to provide more pleasant solution soon.

Regards,
Kirill

0

I'm already on the watchlist and voted for it.
The workaround currently works perfectly for me but a fix will be helpful anyway. I'm very excited about the continuous progress on the PHP debugging support and looking forward to future developments.

0

Ah and btw: yes, this setup is common on XAMPP on OS X since it is the default setup. So I guess I will not be the last one to stumble across this issue.

0

Please sign in to leave a comment.