• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Debugging CI with Zend Studio 9 Debugger

#1
[eluser]vincej[/eluser]
I decided to upgrade my IDE from Dreamweaver + Xampp to Zend such that I can do some serious debugging. I have everything working ie Studio 9 + Zend server CE. including auto complete.

However all the examples given in the user documentation are very simple and not reflective of a complex Codeigniter MVC environment where all the differing views / models and controllers are interlinked.

I am hoping that someone can point me towards some resources or tell me how for example, I can isolate a view / model / controller combination without having to go through the whole application starting at Index.

When I attempt to use breakpoints to isolate a section, I invariably get errors, as if it can not undertake the debug task. Errors such as "No Direct Access Allowed" or "Internal Server Error".

I have tried removing my htaccess file as well as commenting out the "No Direct access Allowed" - that didn't help.

Apologies if this is a bit of a newb question.

Many Thanks !


#2
[eluser]CroNiX[/eluser]
In your browser Zend debugger plugin, go to the settings and uncheck "Break on First Line". This will stop it from breaking on the first line of index.php and instead stop wherever your first breakpoint is.

Also, check "Debug local copy if available" if it isn't.

I assume you know how to set/unset a breakpoint by double clicking on a line number, or to set a variable breakpoint by right clicking a breakpoint and going to breakpoint properties where you can set the conditional break statement (like when $x = 50).

Debugging CI is a bit harder than other frameworks due to the singleton. For instance, you can't set a breakpoint directly in a model or view and have the debugger stop there. Views get included, so you can't step through them. Basically, if you want to step through a models code, you need to set a breakpoint in the CONTROLLER, on the line just before the call to the models method. Then step into the model. If you have any breakpoints set in the model it will then use them, but if you just set a breakpoint in your model and try to debug, it will skip over it and never break in the model.

I haven't seen that error you are seeing when I try to debug, so I can't suggest anything there. It might be because you are trying to trigger the debugger from within Zend Studio. Try setting the breakpoint, but trigger the debugger from your browser using the Zend Studio plugin.

You can also debug agax calls. Set your breakpoint and visit the page in your browser. In the Zend Studio browser plugin, choose "next page" and then submit your ajax form (or whatever it is) and then it will start debugging. Again, just set your initial breakpoint in the controller.

Hope some of that helps.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.