Eclipse PDT and XDebug finally working
Oktober 5th, 2009 | By Christoph in Software-Development | 1 Comment »Yesterday I wanted to give myself a little update what’s going on in the PHP world as I was deeply involved in Java/J2EE in the last 4 years and haven’t done any PHP work besides maintaining some of my websites.
So I decided to give the Zend Framework a try and started going through the Quickstart guide.
Something what always enjoyed in the Java world was the availability of easy debugging. In PHP in the past I have used ugly “echo …” debugging statements and never really digged any deeper. Now the time has come and I read that it is possible too but maybe with some more setup efforts.
Environment
- Mac OSX 10.6.1 (Snow Leopard)
- XAMMP for Mac OS
- Latest Eclipse PDT Full – I downloaded the 32bit Cocoa
- XDebug
The following articles helped me to get setup:
- Setting up Xdebug on Mac OS X (or Win32 / Linux)
- http://www.eclipse.org/pdt/articles/debugger/os-php-eclipse-pdt-debug-pdf.pdf
- http://www.oos-shop.de/xdebug-installation/
- http://www.eclipse.org/pdt/documents/XDebugGuide.pdf
Even though the articles are pretty good I had some minor problems, especially figuring out what exactly I have to add to my php.ini.
That’s why I give you what I have added to the very bottom of my php.ini which lives in the following path: /Applications/xampp/etc/php.ini
[xdebug]
zend_extension=/Applications/xampp/xamppfiles/lib/php/php5/extensions/no-debug-non-zts-20060613/xdebug.so
xdebug.auto_trace=1
xdebug.remote_enable=On
xdebug.remote_host=”localhost”
xdebug.remote_port=9000
xdebug.remote_handler=”dbgp”
The xdebug.so was mentioned in first tutorial above and I got it from here (Komodo IDE: http://aspn.activestate.com/ASPN/Downloads/Komodo/RemoteDebugging)
Here are some important infos and screenshots which might be helpful in understanding my setup:
- php executable: /usr/bin/php
- php.ini: /Applications/xampp/etc/php.ini
One of the most important things was the Path-Mapping, which maps your Eclipse Project structure to the URLs of your web-application.
URL of my app in the browser: http://localhost/zendtest/ZendFramework-1.9.3PL1-minimal/quickstart
Local-Path: /Applications/xampp/xamppfiles/htdocs/zendtest/ZendFramework-1.9.3PL1-minimal/quickstart
This mechanism is important, because it tells the debugger when to stop. If those settings are not correct (and they weren’t correct in my case) then the debugger will not recognize to which file the current URL in the browser belongs to and basically will not stop or will not stop at where you have placed your breakpoint.
Last but not least some screenshots which show the my setup and configuration:




