1. First, we need to download xdebug:
$ wget http://pecl.php.net/get/xdebug-2.2.2.tgz
2. Untarring the .tgz file:
$ tar -xvf xdebug-2.2.2.tgz
3. Changing directory:
$ cd xdebug-2.2.2
4. Preparing the build environment for the installation:
$ phpize
5. Configuring the build environment for the installation:
$ ./configure
6. This step is really important since you need to create the folder where the extensions will be installed:
$ mkdir ../php
$ mkdir ../php/ext
7. Now is time to make some adjustments to your Makefile file, since we need to modify the default EXTENSION_DIR for the one we just created (php/ext which is where the extensions will be installed)
$ vim Makefile
Please notice I've used vim, but you can use vi or nano instead if you are more comfortable with.
Once you are editing Makefile, look for the following string: EXTENSION_DIR, it should look as follows:
EXTENSION_DIR = /usr/lib/php/extensions/no-debug-non-zts-20060613
you just need to replace it with the path I've mentioned before (php/ext):
EXTENSION_DIR = /home/USERNAME/php/ext or the path of your home directory on your shared hosting
Please notice you need to change USERNAME for your real username.
8. Now we can install the extensions without any problem:
$ make
$ make install
9. Add to your custom php.ini extension=/home/USERNAME/php/ext/xdebug.so
That's it.