Hi,

Up until now I've been doing reasonably OK by debugging using a mixture of exit("OK this happened"); statements and kpr(); but I'm finding trickier bugs and want to get more professional with the debugging side of things.

Soooo, I've dowloaded and installed Eclipse for PHP Developers Version: 3.0.2 (INDIGO). I've got it working in a very basic way, i.e. I can make it debug through my "/Chess Drupal 7/index.php" file.

Already however if I try and do something like tell Eclipse that my file is "/chess_drupal_7/index.php?q=vchess/board/6" then I already get it telling me "File does not exist".

Even worse, I really don't know how to capture the return of a click on a form button back into Drupal. i.e. I could I suppose ultimately get Eclipse to trace a page which includes a form with a button or two, but it would only trace it to the point the page has displayed, and then it would terminate the debug session (since the page is complete). Well, as far as drawing that page is, that's true, but I want to debug the input from the form.

Sorry it's pretty vague questions, but it's pretty global gaps in my knowledge.

Any help would be appreciated. Thanks!

Comments

da_solver’s picture

Hi,
It sounds like you just need to install an apache web server on your local machine.

If you've never installed Apache, the trick is to set a <Directory/> in httpd.conf that points to your Drupal installation. It may take some fiddling, but in long run it's well worth the time.

Also check you main php,ini file (global for your machine). Make sure it has a [debug] section with statements like:
[debug]
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
etc, etc ,etc,

Check xdebug's website for a full configuration, Use the output from phpinfo() to verify your setup.

Sorry I haven't used Eclipse for a while. It should have a dialog the that lets you associate Drupal with your local web server. So you debug Drupal while it's running under Apache. You just set break points on the source code (rather that actually editing Drupal's core files with print screen statements). A zillion times more effective than print statements :) You get to debug the actual process flow, not just a data dump at some guessed point of execution.

Again, well worth the set up time :)

drupalshrek’s picture

Hi da_solver,

Thanks for the reply.

In fact, I finally found the problem; I was trying to launch (say) index.php in Eclipse debugger, which went OK, but I didn't know how to get the page that was generated "back into" Eclipse. The problem was to start with I didn't see the tab with the browser output in Eclipse itself (it was covered up with another tab with code in), and so I was thinking about how I somehow relaunch the next step. Once I saw this browser output tab within eclipse I was able to continue the debugging.

Anyway, problem solved, and I'm off to carry on some serious debugging.

Thanks for your trying to help.

drupalshrek