PHP debugging with Zend Framework
hi,
I'm trying to get PHP debugging to work for a project that uses the Zend Framework. I installed and activated XDebug and the IDE is able to connect to the debugger, "Break on first line" works and when I set a breakpoint in the Framework's front controller, it works too. BUT I can't set breakpoints in my own controllers and views which makes the whole debugging of course pretty much useless. Just for testing purposes, I downloaded Eclipse PDT (yuck) and got the debugging running in less than 5 minutes and it also works in my own controllers and views (using XDebug, not the Zend Debugger). So I'm wondering... do you have any ideas what could be causing this and how I could fix it? Or is this maybe something that would have to be fixed on your side?
Thanks!
Carina
P.S.: I have loved Intellij Idea since the very first day I started using it for Java development. But adding JavaScript, then Flex and finally PHP support has made me even more happy, I am really grateful that I can finally use my favorite IDE for coding in all these languages, it makes my day a LOT less painful. I can't thank you enough! I keep annoying everyone who doesn't use it until they finally give it a try and they usually never switch back to whatever they had been using before.
Please sign in to leave a comment.
Hello Carina,
Thank you for your feedback,
Do you mean your breakpoints don't get hit, or they are not even accepted by debugger (breakpoint icon shows cross instead of 'check' mark)?
Besides, consider clearing the 'Stop session when the page is processed' run configuration option if the desired breakpoints are located in the PHP file different from the one that is initially opened in the browser when the configuration is started.
Regards,
Kirill
Hi Kirill,
the breakpoints contain a check mark but the debugger doesn't stop there.
It seems that the same problem was described here for an older version of Eclipse: http://bytes.com/topic/php/answers/798398-xdebug-xdebug-helper-zend-framework
Since this works fine now in Eclipse, I was hoping that there was a way to fix this.
About the "stop session" checkbox: it is unchecked, but thanks for the hint. And the breakpoints in the front controller work fine before and after the code in my own controllers is called (there is also a redirect in between) so I assumed it has nothing to do with a lost session. I also tried setting the ide key manually to "IDEA1" in the xdebug config, assuming that maybe it was for some reason not accessible to the controllers if only passed in as a GET parameter but it (unsurprisingly) didn't help.
Some details: OS X 10.5, XAMPP 1.7.2a + bundled XDebug, Maia-10781
Regards,
Carina
Hello Carina,
Thanks for the details!
Seems like we need to look at the logs. Can you please do the following steps:
1. open <IDEA app>/bin/log.xml with a text editor
2. scroll to the bottom, add the following lines before <root> tag:
3. restart IDEA
4. do your PHP debugging steps including successful breaks at the front controllers
5. log file(s) are to be found at ~/Library/Caches/.IntelliJIdea90/log named idea.log, idea.log.1 etc.
Thanks,
Kirill
PS Please don't try to upgrage to IDEA EAP build 90.193: unfortunately it has PHP debugging broken on Mac : http://youtrack.jetbrains.net/issue/WI-480. Fix will be delivered with the next EAP.
Hi
thanks for the reply. I finally found a solution, so I'm sorry for stealing your time...
The problems seems to have been that although I had a local copy of the Zend framework in my project, the copy that came included in XAMPP was used. I didn't notice that before since I the files where being displayed while stepping through them and so I didn't have a look at the path of the files and assumed it was my local version of the Zend framework. After noticing this, I changed the pear.conf file to include my custom Zend installation (which is included in my Idea project) and now my breakpoints work also in my custom code.
So for me the problem is solved (and I can't tell you how happy I am about this), not sure if this is a bug in the PHP debugger or not. Thanks for your time (and for the PHP support in general! ).
Carina
P.S.: thanks for the warning about the update, that would have been the next thing I would have tried
Hello Carina,
Cool!
I think it's not the bug in PHP debugger, since (as I understood) you were setting your breakpoints in files different from those processed by the server.
Regards,
Kirill
No, I was setting the breakpoints in my own controllers, those are independent from the Zend Framework version that I'm using. And in both cases the debugger could step into the framework files but only in one case it could step into my custom controller files.
But even after fixing the error the problem occurred two more times, so maybe it's just a general instability issue. As long as I now know that it basically should work, I'm ok with that - it's a new feature after all.
Carina
Hello Carina,
If you can reproduce the problem logs are very welcome.
Regards,
Kirill
hi,
I think the error I'm experiencing now is a different one since it always happens when executing a certain action in my application and not when executing any of the other actions (whereas previous error also occurred for those other actions). This is the one I get now:
- in the UI I see the error message "connection error: invalid packet"
- the log file is attached, this is the most important part I guess:
I don't know which "name" and "property" the error message is referring to and how to influence or inspect them.
When I execute the same action and try to debug in Eclipse, it works just fine - which seems a little weird because they are both using the same XDebug version (when I change the debugger port, Eclipse can't debug anymore so I'm rather sure that it is indeed using this configuration):
Carina
Attachment(s):
idea.log.zip
Hello Carina,
IDEA is expecting to receive a valid XML message from XDebug, but seems to get a malformed one ("invalid packet"). To my regret we don't put the contents of this packet to the log (will fix that), but XDebug log should contain it. Path to xdebug log is indeed what you've configure with
Can you please attach this one too?
Thanks,
Kirill
hi,
here it is. Deleted the old log and executed a request that caused an error so if there is anything to see, it should be there.
Carina
Attachment(s):
xdebug.log.zip
Hello Carina,
Up to the moment, the origin of illegal character in XML message coming from XDebug is still not clear.
Nevertheless we've added a patch to handle such an input, along with some more detailed logging. Please check with the next EAP. We may also need new IDEA logs for a deeper look.
Thanks,
Kirill
See also: http://youtrack.jetbrains.net/issue/WI-958