PHP Debugging on PHP IDEs

As NetBeans has started to be a great IDE with powerful debugging features, like most people who are migrating to NetBeans, I would like to use it’s built-in debugger abilities. PHP debugging is not new. XDebug is quite around for some time but it always lacked the attention it has now. From now on PHP Developers are starting to use IDEs instead of colorful text editors. Because from now on, PHP started to be accepted as an Enterprise language. It’s pretty easy to code with PHP, it’s very simple but yet it can be a good base for complex applications. With the newest release of PHP 5, it also contains OOP features and with powerful frameworks built around (CakePHP, CodeIgniter, Symphony, Zend,…) some strict rules apply on designing your application for a cleaner, better code and yet you can still use the quick and dirty ways. :)

Now everybody is trying to debug their PHP scripts with IDEs (Zend Studio For Eclipse, PDT, NetBeans, KomodoIDE, PHPed, Aptana PHP, …) and IDEs try to create a great environment for developers. I really think there is huge IDE war out there, and all of the IDEs have powerful and different features. It’s really interesting to see one feature existing in one IDE, yet not in another. So the choice of the best IDE is not anymore a personal opinion but the one with most features or the best price/performance ratio.

As of now my favorite IDE is NetBeans 6.7 M2 and that’s for sure. I have so far tested Zend Studio For Eclipse, PDT, Aptana PHP, KomodoIDE and all of them has their own advantages. They all have the pros and cons and from time to time my favorite IDE changes with the new releases. I’m sure I may migrate from NetBeans to PDT when the new release comes (if it ever does:).

So long story short, let me come to the point. Every one (except Zend Studio which it has his own debugger but can still work with XDebug) is using XDebug for the debugger library of PHP and here is the problem with it: Two people cannot debug one server! In our company no one develops locally. We have our development servers maintained by system administrators. This prevents the developers from installing whatever they want on the server and having problems on what to install on the production server. So me and 4 or more of my colleagues are using only one development server and all of us wants to debug his own PHP scripts. The bottleneck? All of us have to enter the php.ini file to his own IP address and then restart the Apache! Problem: I don’t have sudo :)

Most of the IDEs I have tried so far, does not look to this problem. Especially NetBeans which thinks that development can only be done on a local machine and in order to edit a file you must create a NetBeans project! There are some ways to overcome this as I have mentioned in my previous post. Remote Development is better on Eclipse based IDEs. But the same file explorer problem applies to Komodo IDE. Why the hell should I need to create a project to just edit one file (I hope that this is my own inexperience with Komodo)!

But truth be told, even the debugging interface is bad on Komodo (even the generaly ui is bad:), debugging features is far more powerful than NetBeans and it solves the problem in our company too! The idea is to setup a proxy server to listen both the host and client debuggers via dbgp. From 3rd party tools you can setup such a proxy written in Python. But you can’t connect to this proxy with NetBeans as there is no such feature. NetBeans assumes that I’m listened by XDebug client, I’m the Host (King) after all. So if your audience cannot hear you, what if you are a King anyway :) You can setup Komodo to be used with such a Proxy and it works pretty well.

Yet everything comes with it’s own price. Komodo is not free (KomodoIDE is not but Komodo Edit is free yet it lacks the debugging features). I have opened an issue about this on NetBeans, I hope that it gets accepted (but nothing happened yet) and the reality about “PHP Developers usually develop on remote servers” gets noticed. I’m just looking for new things to use instead of Vi, the love of my life, the second best editor built for Developers on Linux :)