Welcome Guest, Not a member yet? Register   Sign In
Server Side Debugging
#1

[eluser]jgberg[/eluser]
I am trying to successfully do server side debugging with a full-blown debugger; that is, with breakpoints etc. What I want is to be able to do is debug my code whenever it is exercised on the server. At this point, I've installed a number of remote debugging packages, and so far I've not been able to do what I want. Hopefully, on this thread I can find out if anyone is successfully doing this with CI, and just how it's done.

I have a development machine with apache 2.2.x and CI installed. I have tried these debugger/IDEs: dev-php, eclipse with PDT+plugins, and Zend. I've gotten farthest with Zend as far as enabling remote debugging. Installing this stuff has been hell, just to say it, but eventually I've installed ZendCore, Zend Studio, Zend Debugger, and Zend Platform.

What I would expect, technically speaking is to setup my apache/php environment so that I can connect to it remotely with my debugger, then breakpoint PHP code on the server side such that whenever that code is excercised by some browser hitting the server, when that server runs the breakpointed code it will halt and notify my debugger and allow me to control the code flow from my debugger. There might be an issue with timing out the server response to the browser, but that would be patched.

What I've found is that I cannot make this happen. To be precise, I can run code from the debugger directly, which works fine, but isn't what I need. And I can run from the debugger a URL, which causes CI to choke with "The URI you submitted has disallowed characters." because the debugger is throwing extra crap on the URL and I can't stop it from doing so. And I cannot get it to breakpoint if I hit the proper URL from an external browsers.

So has anyone got this working right? How?

thanks!,
jeffrey
#2

[eluser]jgberg[/eluser]
Well... It appears that I _can_ do what I'd like to do with the Zend stuff... I spent more time going over the configuration, and also found that it installed a toolbar on Firefox which let's me debug a page remotely without screwing up the URL and choking CI.

I have experienced crashes of the zend FastCGI and the failure of the connection between the server and the debugging client (this is all on 1 machine), so I'm not feeling that this is very robust. But at least I've got something semi-functional to try and press forward with.

jeffrey
http://www.jeffrey-greenberg.com
#3

[eluser]@li[/eluser]
Which firefox extension is that?
#4

[eluser]Didier DURAND[/eluser]
Hello jgberg,

I found a solution to your problem: in application/config/config.php, your set config['permitted_uri_chars'] to blank (i.e '') then you bypass the uri character checking security function of CI.

But,
1) watch out the security consequences (see comment in config file)- blank should be only a temporary setting while debugging
2) you will then encounter another issue (that I diddn't solve yet): CI code receives all the weird characters injected in the URL by Zend remote debugging features. CI doesn't seem to like it (at first glance...)

When I find a good solution for this last issue, i'll post again
didier
#5

[eluser]Neovive[/eluser]
I just downloaded the new Eclipse PDT 1.0 release and am unable to get CI to work with the debugger. The problem is similar to the issue above where CI returns a 404 page not found since the debugger is adding query string parameters (e.g. ?debug_session_id=1002&start_debug=1&debug_start_session=1 .....).

I modified the config.php as stated above, enabled query strings, and removed the .htaccess file without any luck. Has anyone else been able to get server side debugging working?
#6

[eluser]Didier DURAND[/eluser]
Hello,

Are you sure that you debugger is active on the Server?
i.e do you see "with Zend Debugger v.x.x." when you do a phpinfo()?

As example, mine says "This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright © 1998-2007 Zend Technologies
with Zend Extension Manager v1.2.0, Copyright © 2003-2007, by Zend Technologies
with Zend Optimizer v3.3.0, Copyright © 1998-2007, by Zend Technologies
with Zend Debugger v5.2.3, Copyright © 1999-2006, by Zend Technologies"

Let me know and then we'll see
didier
#7

[eluser]esra[/eluser]
It would be great to see support for debuggers added to the framework, as well as better unit testing support (SimpleUnit, PHPunit, etc.).

I notice this a few days ago.

http://ellislab.com/forums/viewthread/59944/

The approach uses a subclassed version of Router.php to work around the query strings used by debuggers.

In some typed language frameworks like the Windows Visual C++ MFC framework, debugging is handled using an alternate set of framework files. You basically create a debug and production version of your projects that use alternate sets of framework files. It might be possible to handle CI debugging in this way based on a bootstrap loader (index.php) setting. If a debug variable was set to true, than an alternate set of framework files could be used. Those files could be removed from the directory structure when the project was ready to be released and the debug variable could be set to false.
#8

[eluser]Neovive[/eluser]
I was able to get things working using the Zend Debugger instead of XDebug. I used the modifications to the Router.php script in the above link. The process still seems a little buggy, but at least it allows working directly from the browser which is nice.

Do you have any advice on where to set break points using CI in order to see the most useful information? I did a "Step Into" on one script and it goes back and forth between Common.php and CodeIgniter.php. It's hard to find your actual application variables since everything is going through the Loader.

Thanks for the advice.
#9

[eluser]Neovive[/eluser]
If anyone is interested in Eclipse PDT and Debugging, there is some very good information on these two PDT Wiki pages:

http://www.thierryb.net/pdtwiki/index.ph...d_Debugger

http://www.thierryb.net/pdtwiki/index.ph..._Debugging
#10

[eluser]esra[/eluser]
[quote author="Neovive" date="1190342839"]I was able to get things working using the Zend Debugger instead of XDebug. I used the modifications to the Router.php script in the above link. The process still seems a little buggy, but at least it allows working directly from the browser which is nice.

Do you have any advice on where to set break points using CI in order to see the most useful information? I did a "Step Into" on one script and it goes back and forth between Common.php and CodeIgniter.php. It's hard to find your actual application variables since everything is going through the Loader.

Thanks for the advice.[/quote]

There would be a similar problem with the Config and Language libraries since they also load files. Router is yet another problem. Common.php is basically the front controller's library. As I suggested above, a special set of framework files solely for debugging might be necessary and setting permanent breakpoints in those files might be necessary in order to fully monitor a process.




Theme © iAndrew 2016 - Forum software by © MyBB