Developers/Getting Started/Developers Tools/Eclipse with XDebug
Contents |
[edit] Installing XDebug
Prerequisites
- This guide assumes you know how to set up a working copy of Apache 2.x with PHP (MAMP, LAMP, etc).
- It assumes that you have set up a database for egw 2.0 using a egw 1.4 database dump and created the appropriate config.ini
- It also assumes that you have a working installation of Eclipse PDT.
To install XDebug, either:
- Follow the Instructions at http://www.xdebug.org/docs/install.
- Or follow the instructions here for
[edit] Ubuntu/Debian
[edit] Installing using PEAR
You can install XDebug from the PEAR/PECL project. To do this we need to execute the following command as root:
apt-get install php5-dev php-pear
Now we can install XDebug using the PECL tool:
pecl install xdebug
When the compiler is done, you should see something like this
... Build process completed successfully Installing '/usr/lib/php5/20060613+lfs/xdebug.so' install ok: channel://pecl.php.net/xdebug-2.0.2 configuration option "php_ini" is not set to php.ini location You should add "extension=xdebug.so" to php.ini
Now we still need to edit the php.ini. On Ubuntu Gutsy this is in /etc/php5/apache2/php.ini so we will do this:
nano /etc/php5/apache2/php.ini
Mow find the section called "Dynamic Extensions" and add the following lines (notice the path to the module is part of the compiler output):
;;;;;;;;;; ; XDebug ; ;;;;;;;;;; ;load module zend_extension="/usr/lib/php5/20060613+lfs/xdebug.so" ;some options xdebug.remote_enable=1 xdebug.remote_handler=dbgp xdebug.remote_mode=req ;The following IP should be of the host running Eclipse! xdebug.remote_host=127.0.0.1 xdebug.remote_port=9000 xdebug.idekey= ;Only enable the following if you want profiler output (lots of data!) ;xdebug.profiler_enable=1 ;xdebug.profiler_output_dir=/var/log/XDebug/ ;xdebug.profiler_enable_trigger=1
Now restart your (Apache) Webserver...
/etc/init.d/apache2 restart
[edit] Setting up Zend Framework
For the Debugger to correctly work, it needs to know exactly where to find the include files, in our case the Zend Framework. There are a number of different approaches to this but the one described here is how to install Zend Framework to the global php include path. Under Ubuntu Gutsy this is
/usr/share/php
To check out the Egroupware 2.0 Version of Zend Framework, open a root console and go to the global php include path. Make sure you have the subversion package installed and execute this command.
svn co http://svn.egroupware20.org/svnroot/officespot-cs/trunk/Zend Zend
Now restart your (Apache) Webserver...
/etc/init.d/apache2 restart
Continue here -> Setting up Eclipse.
[edit] Setting up Eclipse
- Go to the Eclipse preferences dialog by selecting Window->Preferences.
- Now go to the "PHP" section and unfold it.
- Open the "PHP Servers" section.
- Edit the Default Web Server
- Change the name to "localhost"
- Make sure the url reads "http://localhost/dev" - change to your taste but remember the "xdebug.remote_host"-directive in your php.ini!
- Select "Publish Projects to this Server" and enter "/var/www/dev" as the path - change this to your taste, but remember you need write privileges (easiest is to chown "dev/")
- Click OK
- Go to the PHP Executables section.
- Edit the default entry
- Enter a name e.g. "PHP5"
- Enter the path to the executables (Ubuntu/Debian: /usr/bin)
- Change the debugger to XDebug and click OK
- Now open the Debug Section.
- Change the PHP Debugger to XDebug
- Make sure the Webserver is correct (localhost)
- Make sure the PHP Executable is correct (PHP5)
- Click OK to leave the preferences
Now we will perform the first debugger launch and complete setting up Eclipse.
- Open the "index.php" in the egroupware20 project.
- Now right click it and select Debug as=>PHP Web Page
- In the Dialog make sure the URL is correct
- Press F8 - you should now see something like this. - screenshot
Some shortcuts for the Eclipse debugger:
- F8 lets the debugger run free
- F6 Step over
- F5 Step into



