Install XDebug – the quick and painless way

If you find that you need to compile xdebug from source for whatever reason, have no fear! It’s actually quite simple to get it set up and running. I can get it set up on most servers in under 5 minutes. The directions below are for a local environment.

Make sure that you haveĀ git installed, since we are going to be grabbing xdebug from their git repository.

git clone git://

Now just go into the directory you just downloaded.

cd xdebug

Now run the following commands (NOTE: if you you get a message that phpize is not a valid command try installing php5-dev or php5-devel):

sudo make install

Now you will have a file in modules called Copy this to anywhere that you feel makes sense. I usually copy it to /etc/php.d or similar.

sudo cp modules/ /etc/php.d/

Now edit your php.ini file. If you’re not sure where to find it run locate php.ini. Add this to the very bottom.

zend_extension = "/etc/php.d/"

If you want pretty var_dump(), you can also add these:


In order for the pretty var_dump to work, you also need to set html_errors to “On”. So look for that in your php.ini file and set it to On. If it’s not in there you an add this line:

html_errors = On

Restart your web server and php-fpm if you use it. Check that everything is working properly using this command:

php -i | grep xdebug