Setting up xdebug/DBGp for PHP on Debian/Ubuntu
Developers frequently need to trace the execution of their code, and debug it, and Drupal/PHP is no exception.
This article focuses on xdebug, and how you can set it up on your development machine or server.
xdebug provides the ability for more than one person to have debug sessions concurrently on the same server, using the DBGp protocol. Not all IDE's available support this feature however.
IDEs that use DBGp at present are:
To install xdebug on a debian/Ubuntu system enter the following commands from sudo bash or root shell:
First, install PHP and MySQL if you already do not have them. You may not need the gd library if you do not have image manipulation modules.
aptitude install apache2 php5 php5-gd mysql-server php5-mysql
Next, install PHP development, Apache development, and PEAR.
aptitude install apache2-dev php5-dev php-pear make
Lastly, install xdebug using PHP's pecl
pecl install xdebug-beta
This last step will run for a while, compiling xdebug from source. It should not have any errors.
After the last command completes, you will have an xdebug.so library. You now need to configure apache to use it.
To do this, edit your PHP configuration file /etc/php5/apache2/php.ini and add in it the following section just before the [Date] heading:
If you are using this on a server that is separate from the machine that you run the IDE in, then change the host name in xdebug.remote_host from localhost to the name of your server.
You can now use an IDE that supports DBGp to debug PHP applications, including Drupal.
Is your Drupal site slow?