7. Enabling xdebug

If you want good debugging features, it can be a good idea to install xdebug. You get it at http://www.xdebug.org/.

After extracting xdebug-2.0.0beta5.tgz in the ~/src directory, the only thing you have to do is follow the steps in the provided README file.

Restart Apache, check your PHP version again, and you will see that Xdebug is enabled.

$ php -v
PHP 5.1.2 (cli) (built: Mar  2 2006 23:02:55)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
    with Xdebug v2.0.0beta5, Copyright (c) 2002, 2003, 2004, 2005, by Derick Rethans

Now you have fancy var_dump output at least. Additionally you can install a debugclient, that can be run from a shell.

$ cd xdebug-2.0.0beta5/debugclient
$ ./configure --with-libedit
# make
# make install

Add the following to your php.ini

xdebug.remote_enable = On
xdebug.remote_host = "localhost"
xdebug.remote_handler = "dbgp"

Restart Apache (again..), run the debugclient

$ debugclient
Xdebug Simple DBGp client (0.9.1)
Copyright 2002-2005 by Derick Rethans.
- libedit support: enabled

Waiting for debug server to connect.

Go to http://localhost/info.php?XDEBUG_SESSION_START=xtest

<init fileuri="file:///usr/local/apache/htdocs/info.php" language="PHP" protocol_version="1.0" appid="29893" idekey="xtest">
	<engine version="2.0.0beta5">Xdebug</engine>
	<author>Derick Rethans</author>
	<copyright>Copyright (c) 2002-2005 by Derick Rethans</copyright>

From here on (the cmd), you are able to use the DBGp commands. But that is beyond the scope of this installation guide.