Configure XDebug with Bitnami PHP Stacks on Linux Ubuntu

Fact is that if you want to develop something more than a dynamic menu in php, you’re going to need a debugger. You’re going to need it badly and you don’t even know it (shame on you!).

So let’s start from the beginning. You got bitnami lapp (or lamp) stack because it’s cool and doesn’t need so much configuration (if any at all). So you’re basically ready to start coding.

You realize you need a debugger. You search for it and you find out about xdebug. Cool. Then you approach the Xdebug download page and you see only sources and many windows binaries. Not cool.

Getting XDebug to work on Ubuntu Linux with the Bitnami Stacks

You want the fast, easy way. Here it is.

Fire up a terminal window.
Type in

sudo apt-get install php5-dev php-pear

Don’t worry, it won’t mess your system up. It won’t conflict with the Bitnami stuff. Go ahead and do it.
Then type

sudo pecl install xdebug

It should compile a nice file called something like xdebug.so.
You want to locate that file so type

find / -name 'xdebug.so' 2> /dev/null

Note down the path (probably something like /usr/lib/php5/20060613+lfs/xdebug.so).
Now copy that file from that path to your bitnami php extensions folder.
Something like this

cp /usr/lib/php5/20060613+lfs/xdebug.so /path/to/your/lappstack/php/lib/php/extensions

Now there’s some editing:

sudo nano /path/to/your/lappstack/php/etc/php.ini

and type in the following at the end of the file.

zend_extension=/path/to/your/lappstack/php/lib/php/extensions/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
 
[ZendModules]
Xdebug

Now you’re done.

Bonus: configure NetBeans to run with the XDebug extension

Just open up the option window (Tools->Options->PHP tab) and type in the correct path to the PHP client. Something like /path/to/your/lappstack/php/bin/php

Ubuntu XDebug with Bitnami - Options Panel

Just type in the correct path and you're done

Now happy debugging with Bitnami and your lappstack (or lampstack).

This entry was posted in Linux, PHP and tagged , , , , , , , . Bookmark the permalink.

Comments are closed.

blog comments powered by Disqus