Tuesday, May 09, 2006

PHP IDE Debug Protocol

Lately there were many questions and comments on blogs and in PHP related forums regarding the debugger protocol, which will be used in the PHP IDE project at Eclipse.org. For those of you who are not familiar with the 'debug protocol' term or do not know what I am talking about here is a short explanation.

Debugging a PHP application or a PHP web server requires connectivity between an IDE and a Debugger engine (a PHP module which is installed on the web server). The debug protocol defines this connection. It determines how to initialize a debug session, which messages to use, etc. The level of debugging support, debugging performance, and the debugging extensibility are all derived from the debug protocol used.

Today there are two leading debug protocols: DBGp, an open source protocol and Zend Studio's protocol. Both protocols have been used in commercial products in the last few years and are good solutions for debugging PHP applications and PHP web servers.

When the Eclipse Foundation approved the PHP IDE project, Zend Studio's debug protocol was opened source and was chosen to be the debug protocol of the PHP IDE project. Zend Studio was known for its debugging capability and it is considered one of its big advantages, therefore, the decision to open source the protocol was obviously a big decision.

Why choose Zend Studio’s protocol?
Choosing is difficult, but choosing between two good alternatives is even more difficult. Both protocols have proved to be good solutions. So why we chose one over the other, there are two main reasons:

1. We chose performance (binary based protocol) over easy server side implementation (textual based protocol).

2. We preferred a solution designed specifically for PHP and is not bounded to support additional scripting languages. DBGp supports several scripting languages and from this derives some of its disadvantages. We believe that a debug protocol should be as 'close' as possible to the PHP language.

There are other differences between the two protocols and I will try to examine some of them:

DBGp has a built-in Proxy mechanism, which allows multiple users debugging applications on the same development server. The Proxy mechanism has few bugs in it and as written in the DBGp documentation, it is not well defined: “We should think a bit more about what a proxy might need to do”.
The PHP IDE debug protocol does not specify requirements for a security system but defines that the Debug server should receive the client IP before initializing the session. By using the IP, implementing a security mechanism is very simple.

PHP Script Output and Errors
DBGp supports PHP execution stdout and stderr as a general solution for all supported languages. PHP IDE as a specific protocol for PHP can distingue between header output and standard output and between all types of PHP errors (warnings, errors and notices).


Hello and welcome to my blog!
My name is Guy Harpaz and I am the Product Manager of the PHP Developers Tools at Zend and the PHP IDE Project Leader at Eclipse.org. I have more than 6 years experience in the PHP market space in product management and development group management (before my current position I managed the Zend Development Tools R&D group).
I hold a Bachelors Degree in Computer Science from The Prominent Interdisciplinary Center Herzlia and am currently completing my obligations for an MBA from the University of Tel-Aviv.

For me these are very interesting times at Zend and I would like to share my thoughts with you. I welcome feedback and I hope you will find my blog interesting.