Categories: PHP, Web Development

The pain of PHP debugging

You would have thought by now that I am up and running with a good PHP development environment and coding away furiously. Nothing could be further from the truth. I got stuck on debugging PHP. The main problem is this: I am too thrifty (some would say cheap) to invest in a proper PHP IDE. Instead, I have spent much time looking around for open source alternatives, or failing that, anything that is free.

I don’t think I have downloaded everything that is out there, but I can guarantee you, I have downloaded most. I have tried several trial versions of commercial IDEs. I can’t believe how many PHP Editors/IDEs there are, and as I keep looking, it seems I find more of them. The one thing that a good commercial IDE has, of course, is debugging support. Preferably something that starts its own local web server where debugging is already enabled, and saves you the time and hassle of setting it up yourself. That’s not worth n amount of dollars to me, though.

Instead, I have embarked on a mission to get the debugging working through many hours of toil. I have tried both PHPEclipse and PDT. Both have their drawbacks: PHPEclipse does not seem to be very actively maintained (anymore, at least), while PDT is still very immature. I got DBG debugging working with PHPEclipse, but for some reason, when up and running, the client ate up all of my CPU power. I wasn’t interested in finding out why, so I moved on.

I have now settled on a solution that I think will work for me in the long run: I don’t need to have debugging integrated into my IDE. I will use a standalone debugger. I can (and think I just might) use the freely available (see how your ears prick up when you hear those words?) Expert Debugger. It is a (and I repeat) freely available DBG client, and it does the trick. Quite nicely, actually.

There are of course alternatives to DBG, like XDEBUG, GUBED and APD (whose site I have been unable to reach the last few days, signalling either its demise, or that scores of people are frantically trying to get on to the site; either way, I cannot say anything about it).

Of these, GUBED (which you may have guessed at first glance is “debug” spelt backwards), is an interesting concept. It requires no modification to your web server. Instead, it consists of a number of PHP scripts that you install on your server, and with which you start a debugging session and then launch into the scripts. A debug client is also provided, so it has everything you need in one package. GUBED is on version 0.2, but for its sake (and mine, chiefly), I hope it makes it to 1.0. I have yet to report on its success, as it keeps crashing on startup of the debugging, but I am determined to get it working.

The only thing with the DBG-based Expert Debugger is that I have had to make changes to the Apache config to enable and disable DBG. This I have now solved by creating a virtual host, in which I point to a different location of php.ini where I can enable DBG, and leave my primary host untouched.

You see, not spending money on things merely to make your life easy is a good thing! In the process, you learn a lot.

Having decided to separate my concerns for a PHP Editor, in which I can code (hopefully not just PHP, but HTML, CSS, Javascript, etc.), and a PHP debugger, leaves me free to choose any PHP editor I wish. I hope Aptana includes PHP support soon, although I think that you may be able to integrate the plugin with PDT on the same Eclipse installation. If I get it working and it’s interesting, I will let you know.

Article info

Leave a Reply

Your email address will not be published. Required fields are marked *