<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
I contacted the main developper of Geany to ask him if integrating a
PHP Debugger in Geany was planned. Unfortunately, there is no plans for
this.<br>
I would like to have this in Geany since it is the only primary thing
that prevent Geany from beeing a major PHP IDE to my opinion. It has
many advantages over other IDE's i used for PHP : straight foward &
simple, fast, lightweight, not too many dependencies (easier for cross
platform), fit for more than one language.. etc. I think you know the
advantages....<br>
<br>
I have basic knowledge in C++ so i don't think I would be able to do it
myself but with some help I would be glad to participate in this
project if someone is willing to this.<br>
<br>
However, here are some explanations on how a debugger works, what work
should be done to integrate this into Geany<br>
<br>
First of all, a PHP debugger is an extension your load in the php.ini
file on your PHP developement server as usual extention for PHP. There
are mainly 3 debuggers available for free to install on your web server
: <br>
<br>
- xdebug (free open source) <a class="moz-txt-link-freetext"
 href="http://xdebug.org/">http://xdebug.org/</a><br>
- zend debugger (free, not open source)<br>
- DBG (free open source) : <a class="moz-txt-link-freetext"
 href="http://sourceforge.net/projects/dbg2">http://sourceforge.net/projects/dbg2</a><br>
<br>
These debuggers opens a port on your test server ie. Zend Debugger (the
one I used the most) opens normally port 10000. It uses this port to
communicate with the app ie. Geany (with the client debugger running in
BG) to listen to where breakpoints
should be. It also sends stack information, current line, current file,
etc. like a normal debugger would.<br>
<br>
On unix, a PHP debugger is normally a .so file (shared object). On
windows, a DLL file. The .so or .dll file must match the PHP version
you are using. Only the main version and sub version must match. ie PHP
5.2.25 would need a debugger named xxx.5.2.so for unix/linux. This is
for the server part. Not all debuggers provides different versions for
different versions of PHP... DBG for example supports all major PHP
versions with the same DLL or .SO. Zend however do provide different
DLL or SO for all PHP versions<br>
<br>
I dont know the internal mechanics of the debugger but I know how to
install it. However, the free debugger DGB would be a nice way to
introduce PHP debug into Geany since it is open source. Also, PDT for
eclipse supports Zend Debugger and I'm pretty sure it is open source
(so is Eclipse!) so we can see how to do it (unfortunately in java..so
a bit of java understanding is needed here).<br>
<br>
In order to add this functionnality in geany, these must be implemented
:<br>
<br>
- A communication channel between the debugger & Geany. <br>
<br>
Perhaps there is a client & server part for each debugger. <br>
In DBG,
a command line utility is available to debug a page without an apache
server. <br>
<br>
Starting to debug a page on apache server is done this way by
url call:<br>
<a class="moz-txt-link-freetext" href="http://myhost/mydir/myscript.php">http://myhost/mydir/myscript.php</a>?<font
 color="#33cc00">DBGSESSID=1@clienthost:7869<br>
</font><font color="#33cc00"><font color="#000000">Just appending the
green part to the url fires up the debugger...</font></font><br>
<font color="#33cc00"><font color="#000000">or by the commandline this
way : <br>
<font color="#33cc00">dbg</font><br>
</font>>set mode on<br>
>set mapurlroot <a class="moz-txt-link-freetext"
 href="http://localhost/">http://localhost/</a><br>
>set mapremoteroot /usr/local/apache/htdocs/<br>
>set maplocalroot /usr/local/apache/htdocs/<br>
>file /usr/local/apache/htdocs/myfile.php<br>
>run<br>
>break /usr/local/apache/htdocs/myfile.php:12<br>
>cont<br>
<br>
<font color="#000000">DBG have a DBG-cli as a client you can capture
command line output  in Geany & interract with the debugger in
background.<br>
Communication between app & debugger may vary from one to
another... not sure it is always as DBG does...<br>
<br>
</font></font>- Stack pannel : Displays variables values, expandable
object structures & values within objects, ...<br>
- Watch pannel : displays infos about a variable each time it
encounters a breakpoint.<br>
- Local stack (normally presented as thumbs in the same pannel as stack.<br>
- Output view (optionnal but useful)<br>
- Errors view... the errors PHP encounters while parsing the page.<br>
- A browser plugin for firefox (similar to zend toolbar, a must have. I
guess I could do that, its in XML... so I'm ok with this !). This
plugins allows a browser to start a debugging process & opens the
file in Geany.<br>
- A debugger configuration dialog. Sets the base path of the server so
files are converted tu urls by the app when you start debug from the
app.<br>
- A setting to automatically add breakpoints on first line & ending
line of a script.<br>
- A clear all breakpoints setting<br>
- A clear all breakpoints in project setting <br>
- A test debug connection functionnality (tells if the debugger works)<br>
- A port setting to change the port used (don't know how this might
work...)<br>
- The ability to bind a key combination to hide all debugger pannels
(they take a lot of screen space and have to be showed & hidden
often)<br>
<br>
In the edit area :<br>
- Clicking on a line number toggles a breakpoint. Normally visible by
changing bg color of that line.<br>
- When a breakpoint is reached, the BG color of that line must change
to something really visible.<br>
- As PHP debugger goes into included files, files containing a
breakpoint should automatically open & have focus<br>
- While debugging is stopping on a breakpoint, you should be able to
add other breakpoints in any file live (without restarting debugger)<br>
<br>
I know that the app ie Geany has to controls the debugger. For example
you normally have a play button, a step into, step out & a stop
buttons to control debug progression. The app must send a signal to the
debugger port/or hidden commandline to tell continue to it. In DBG it
is a command issued on
the command line in an hidden shell...<br>
<br>
I'm pretty sure all the vars are not queryed by the app. Ie. the app
dont know which vars should be in the stack. Instead the debugger send
all vars & values to the app. & the app displays them blindly. <br>
<br>
* For local & general stack views, I think the app must do
something for this... I'm presuming the app must know in which
object/function we are and filter the stack data to reflect the local
view... not sure after reading a bit on DGB thought.<br>
<br>
* I never looked into a debugger code neigther I unsterstand how the
communication works between the app & debugger so I am making
assumptions here (where there is a * before a line)...<br>
<br>
Other infos you might find useful :<br>
<br>
- I never saw a PHP debugger run fast. Is is all slow, I suspect the
debuggers from being coded in an awful way...<br>
- Only one debugger can run on a PHP install. That means that if you
install one by loading the extension in your PHP.ini file, you have to
remove it & load the extension for the second, then restart apache
to make it work.<br>
- Zend Debugger : I came across a couple of innacuracies with Zend
Debugger particularly in complex PHP apps. A script was not working, a
bug in there somewhere maked it stop. I debugged this script with Zend
and it passed throught it without an error. So I am suggesting to take
another debugger than that one or add multiple debuggers possibility to
Geany (this feature is not present in any IDE I saw, would be nice
thought).<br>
- There is a toolbar for firefox to use with DBG debugger (from
NuSphere) so this a bit less work ! <br>
- DBG is free and has been in the market for a long time... as long as
Zend Debugger.<br>
- xDebug is fairly new<br>
- I heard bad & good comments with xDebug but never tried it. Seems
like it is not ready for stability & accuracy yet. However it may
have evolved since these comments.<br>
<br>
That is all I can think of right now...<br>
<br>
I'll check if I can find a more in depth doc about how to communicate
with a debugger in the point of view of Geany. There is a brief view of
how to communicate with the debugger in the DBG CLi sources in the
readme file...<br>
<br>
I attached you DBG C++ source code so you can see by yourself...<br>
Included DBG CLI (client commandline)<br>
& DBG (server part)<br>
<br>
Let me if someone is interested in doing this plugin for geany... <br>
I personnaly would choose DBG for the debugger but that should be more
discussed before doing anything.<br>
<br>
<br>
<div class="moz-signature">-- <br>
<font style="font-family: arial,helvetica,verdanna; font-size: 10px;">Cordialement,<br>
Emmanuel Morin<br>
</font><font
 style="font-family: arial,helvetica,verdanna; font-size: 9px;">Président</font>
<br>
<img src="cid:part1.08010109.01070701@translucidedesign.com" alt=""
 height="72" width="358">
</div>
</body>
</html>