Remote Debugging XDebug not breaking on breakpoints
I have been able to get things set up pretty much. The setup: running PhpStorm on a mac, running Apache/PHP on an Ubuntu VM. The site has friendly URLs with routing to construct the appropriate viewer class. I use Chrome with the XDebug Helper extension.
My settings:
[Zend]
zend_extension="/usr/lib/php5/20060613+lfs/xdebug.so"
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_host = 10.1.1.102
xdebug.remote_autostart=0
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_mode=req
If I set the IDE to break on the first line, it says "<invalid frame>" in the debug call stack -- I see the HTTP headers in the var window... but it doesn't jump to any source and I can't step. If I turn off the "break on first line" it just ignores all breakpoints. I feel so close...
Any help is very much appreciated.
Paul
请先登录再写评论。
Hi Paul,
Which version of PhpStorm are you using exactly? Seems to me it is not the latest EAP (PS-98.145) as that particular error was fixed in latest build (I had the same behaviour with debugger).
1) Please upgrade to the latest EAP: http://www.jetbrains.net/confluence/display/wi
2) Make sure you do "File | Invalidate Caches" after launching new build for first time
P.S.
BTW, when it says "<invalid frame>" in the debug call stack -- you can actually debug the script -- but you will not be able to see the current execution line and any breakpoints are ignored (this has been fixed).
Thanks for the notification of the new version. I downloaded that version and 98.240 which came out a little later but still have not been able to get it to work. It's behaving as it did before, where I can see that it connects (if "Break at first line" is on I can see the HTTP headers. As you said, I can "Step" and it shows local vars but doesn't indicate where I am in what file, if it's off I see a quick flash as it's working) but it won't stop on breakpoints.
Any other ideas?
Paul
Hi Paul,
Well .. it was working fine here since that build .. and still does right now -- I had no issues so far.
What I would recommend -- is to create brand new very simple project -- just one file with few basic lines (like adding $a + $b and printing it). Try to debug it and see how it goes.
I may also suggest to make completely fresh installation -- just backup your .WebIde10 folder so you can preserve your settings (should be in your home folder -- don't know what OS you have -- I guess it's Linux-based).
If it still does not work well for you -- can you post some screenshots here (for that test project)? -- like how you setup debug profile in PhpStorm, describe how you invoking/starting debugging session. You have mentioned that you still cannot see execution point -- screenshot of this moment as well (it may be useful, especially on small file where you have only few lines and you cannot lost).
If not me then somebody else may have some other ideas -- right now is too little information available to determine what and where may go wrong.
Well, just since my last post I made some more progress. I got it to start respecting my breakpoints, even though it won't jump to the execution point (and I could step and watch the call stack and local variables but it wouldn't show me what line it was on.
More details of the environment:
1) Running a MacBook Pro as the host.
2) Have Ubuntu VM and mount the drive. Files are located in as /Volumes/source/main/httpdocs
3) Local server URL where the home page is is http://dev-vm-01.myserver.com/httpdocs/
In Run/Debug Config [Configuration Tab]
My "server" option [...] has the following settings:
Connection
Mappings
Start URL
[Debug Tab]
Debugger: XDebug
Advanced Setting: wait for ide key : XDEBUG_PAUL
Server overrides: none
I invoke through a Chrome extension "xdebug helper" with the "XDEBUG_PAUL" passed.
I put the IDE in debug mode, call the page, it will (now) stop on the breakpoint I have, but will not show me execution point. If I step-into, I just have to know where it went and deduce which line it is on by what's being called. My Frames window shows "<invalid frame> (PageViewer->render)" (or current correct call stack).
I feel like I'm extremely close now that I have it recognizing my break-points, but still missing something. I appreciate your help.
Paul
Hi Paul,
I'm using debugger in pretty much the same way as you do (similar "debug tab" setup + the same extension for Chrome -- but I'm mostly using Firefox with similar extension). I'm on Windows (XP SP3 at work PC and Windows 7 x32 at home). Basically, before debugging, I'm turning debugger on (Run | Debug or appropriate button on toolbar) so debugger window says "Waiting for connection on port 9000 with ide key 'XXXX'" and then using browser extension for the page I want to debug.
I do not remember any new tickets about <invalid frame> behaviour. Therefore -- I know, it sounds stupid, but can you ensure that you have the latest EAP (98.240 or newer). BTW -- it looks like even newer build is already available (98.271). Also, do you have the latest version of Xdebug?
And I would strongly suggest you to try a fresh install (backup and then delete .Webide10 folder -- on Mac it may actually be these folders (info taken from this topic:http://devnet.jetbrains.net/thread/291711?tstart=0):
~/Library/Preferences/WebIDE10 (important one) and ~/Library/Caches/WebIDE10 (not important -- can be just deleted)).
If after clean install it still does not resolve your issues -- then I may only suggest you to report this to a bug tracker: http://youtrack.jetbrains.net/issue/WI-3844?projectKey=WI#newissue=yes
Hello, Paul
What is the path to server root on your Ubuntu VM?
I suspect that "/Volumes/source/main/httpdocs" is the path to root folder on your host machine and is different from the path on Ubuntu VM.
Thanks for your help!
That's correct. The "/Volumes/..." path is from the perspective of the host, not the VM. Are you saying the "Local Path" should be set based on where it is from the perspective of being inside the VM?
inside the VM, it's just /source/main/httpdocs
But the form won't let you select something that's higher up than the project folder.
Paul
Well, if that is the case (which I completely missed since mine path is exactly the same on remote and local) then try to add Server Path Mapping:
1) open your debug configuration
2) "Debug" tab and then "Server path mappings..." button
3) add your paths there. In your case it should be
"/Volumes/source/main/httpdocs" in "Local Path on Client"
"/source/main/httpdocs" in "Local path on Server"
That's if your php scripts are located in website root folder, which is httpdocs. If they are in different upper folder (let say -- /source/main/app) then tweak these paths accordingly (or remove last folder in a path).
Message was edited by: Andriy Bazanov
Woo-hoo!! That did it! Thank you!!
Absolutely right. Thank you Andriy!
Paul,
Unfortunately, the only way to get fully correct synchronization in your case is to configure FTP connection.
What does "fully correct synchronization" refer to?
Paul,
I mean that your server works in mounted folder from your host machine perspective only.
Your server works on VM and from VM perspective it is remote system and FTP synchronization is intended for such cases.
So, I know that it is not reasonable to set up FTP server in your case, but I just want to clarify you why you should add any custom path mappings.
Ah, ok. Thanks for the responses and I'm glad I've finally got it all worked out.
Paul
Hello Nikolay,
Could you please tell my whether i've configured the IDE correctly.
I run server and PhpStorm on the same machine. Using denwer as a server and it creates virtual drive. I've managed to configure maping settings and IDE stops at breakpoints, but it opens new file for it.
For example my files are located at d:\webservers\home\test\www i put breakpoint in the index.php and when i run debuger, PhpStorm opens same file from the server (virtual drive) z:\home\test\www\index.php. It's possible to debug in this way, but if i'll put breakpoints in 5 files, it will result in 10 opend files in the IDE. Do you have an idea how to make it stop in the original file?
Thanks
Dmitry
Attachment(s):
debuger.png
Dmitry,
Try latest EAP build (PS-98.521) it can handle such mapping situations where symlink/virtual drive is involved much better (telling from my own experience). The 98.521 build should ask for a proper mapping once you will start debug session for first time and later you can edit your mappings in Settings | PHP | Browser Toolbar Debug Mappings.
Hello Andriy,
Thanks a lot for your quick response. As you advised i've installed the latest version of the app. But still no success, moreover now i even can't make it stop at breakpoints in the separate file... I've attached loooong screenshot with step by step actions i do. Could you please suggest something?
p.s. when i installed app, it asked me for mapping at first launch, i selected files from local dir, bit it didn't help much. after that, i deleted .idea dir from the project and recreated it once more but mapping window didn't pop-up. and now it stops ONLY if i put "break at first line" checkbox and new window with file from virtual drive is opened. :(
Attachment(s):
1.png
Hi Dmitry,
On the screenshot you have provided I do not see window with mapping settings. Please show a screenshots of these windows:
Please make sure that you expand the top level entries.
I've attached screenshots. At the "browser toolbar debug mapping" page i've tried full and relative path...
Attachment(s):
php - Browser toolbar debug mapping.png
debuger - php.png
TBH, because PhpStorm itself opens file using z:\home\test1.ru\www path (based on screenshots you have provided), I think it should work just fine.
Can you enable and collect debugger log -- this should give us some insight info we need.
:( May be it doesn't work with Denwer tool? Here is attached log file. Last run 17:29.
mapping settings are:
Z:\home\test1.ru\www — on server
D:\webservers\home\test1.ru\www — local path
it didn't stop at breakpoint("break at first line" is disabled)
Thanks for your help Andiy.
Attachment(s):
idea.log.zip
Hello Dmitry,
Try to help you with your initial scenario(runnnig debug session from PhpStorm). The problem is in your deployment type. You need "mounted folder" type indeed.
Mounted folder path is "Z:\home\test1.ru\www".
Look at the attached screenshots.
Attachment(s):
test2.png
test1.png
Nikolay,
I have not been using "Mounted folder" deployment myself (only FTP and Local), but I have a question for this particular situation:
Z:\ = D:\Webservers\ (Both folders physically are on the same PC\HDD partition).
If I understand whole process correctly, PhpStorm will copy/upload file from Local path to Mounted folder, which in this situation is basically copy file into itself (overriding the same physical file, just different path).
Is that how it works? Will such read/write cause any troubles? And why Local deployment is not the right choice?
(I would not ask these questions if Z:\ would be on another server/computer accessible via LAN/VPN. I just would like to know this for myself, because if I would be in the same situation, I would still go the same way as Dmirtiy did -- Local deployment).
Dmitry,
About "Browser Toolbar Debug Mappings" settings.
Everything is correct with but this settings use only when you initiate debug session from browser(using easy Xdebug e.g.)
No, it works with Denwer as well as with xammp, zend server and so on.
Everything had been working fine. However, the latest patch that came down and installed itself removed the ability to have the IDE set to wait for the IDE Key. Remote debugging now always launches a new tab (rather than just using the browser plugins) and it reported that it had mapping problems even though everything had been working before. The screen to resolve the mappings is very confusing, it's not clear that you're supposed to click into the invisible column to the right and paste in the path from the top of the dialog.
Paul
Hello Paul,
Workflow is not changed a lot. The only major change is that you can accept debugger connections with any ide key and you haven't run any debug configurations in PhpStorm every time when you want to debug a page. And then in latest EAP PhpStorm can accept several debug connections with same ide key at the same time - so you can debug all AJAX requests.
You don't need to set any ide key anymore. So you can use any browser plugin.
Yeah, this UI is quite powerful, but can confuse. We have already got several issues about it - WI-4317, WI-4292. We are working on this problem.
New debuger features brings some problems and debugging process is quite unstable in the latest EAP, but we have already resolved several related critical issues and debugger support in the next EAP will be more stable and handy to use.
Thank you for your feedback!
I'm also getting breakpoint warnings that the remote file doesn't exist, even though the mappings are set up and it does exist (side note: there's a grammar error it says "remote file is not exist" should be "does not exist")... it still all works, just has a warning on the breakpoint icon and tells you about the issue on hover over.
Also, it'd be nice if when debugging, the IDE didn't tell you about unused variables. It doesn't recognize used variables referenced by string for smarty template.
$myvariable = array(3,4,5);
$this->set(compact("myvariable"));
$myvariable shows as grey and during debugging, if I hover over it, it will tell me that it's unused rather than telling me the value. The option to inspect the variable shows up after a second, but when you go to hover over for variable inspection, it disappears before you can click the [+] to expand it... you just have to look at the "variables" pane to inspect it.
Also, most times while it's debugging I don't have the option to stop or resume, but I can still step-through.
I look forward to some of the fixes. This newest release is much less convenient or intuitive than previous versions.
Paul
Paul,
This feature checks every registered breakpoint with file_exists(). It can works wrong if you use safe mode on your server. Anyway, it will be possible to disable this validation in the next EAP.
Please fail a feature request in our bugtracker(http://youtrack.jetbrains.net/issues/WI).
Yeah, we already have issues about it - WI-4311 , WI-4320.
Most of critical issues are already fixed.
We are working on it.
Thanks for your feedback!
I downloaded and installed the latest patch and this is even worse in some respects.
Previously... (with IDE_KEY debug option)
I set the breakpoint
I enter debug mode
I turned on the plugin
I refreshed the page
It broke where I wanted
Now...
I set the breakpoint
I click debug
It launches another tab set to the home page
It stops on lines I didn't set to stop on
I press "resume" hoping it will jump to my next break point
It opens a file that has nothing to do with my breakpoint
I click resume again, and another unrelated file is opened, stopping on the first line...
Resume, resume, resume... it opens a million files that have nothing to do with my breakpoint
I cannot get it to stop on my breakpoint, they're all stopping on the first lines of unrelated files...
Guys... what is going on... (???)
I have "break on first line" set to false.
Also, as a side-note, indexing after a reboot or an upgrade takes 30 minutes with all the files I have (many many jpegs). I have a coworker using another IDE who has the same set of files and it takes under 2 minutes to re-index.