How to setup a LAMP environment with xdebug under ubuntu

First of all, we need to setup the lamp (linux+apache+mysql+php) environment.

So, fire up the terminal and type:

sudo apt-get update
sudo apt-get upgrade

If you don’t know which version of Ubuntu you are running, just type:

cat /etc/issue

If you are using ubuntu 6.06 you just need to run.

sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server

If you are under anything more recent that 6.06

sudo tasksel install lamp-server

After this we need to install xdebug.

sudo apt-get install php5-xdebug

To activate and configure xdebug, we need to edit php.ini

nano /etc/php5/apache2/php.ini

In the end of the file, just add

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

If you are developing from another computer, we need to specify that ip address under xdebug.remote_host.

We restart the server

sudo /etc/init.d/apache2 restart

And we are done.

Tags: , , ,

This entry was posted on Friday, September 19th, 2008 at 3:18 pm and is filed under Development, Tutorials, php. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

3 Responses to “How to setup a LAMP environment with xdebug under ubuntu”

Francisco Costa September 22nd, 2008 at 11:14 am

Nice tutorial!
Give us more! :)

fred November 9th, 2008 at 7:03 pm

thank you..!

mike November 25th, 2008 at 6:39 pm

xdebug helped me solve a problem I have been working on for 10 hours in 30 minutes.

Thanks!

Leave a Reply