if you are like me and having both php 5.2 (compiled from source) and php 5.3 (installed by apt-get) on the same development machine (ubuntu 11.10), then one day you decide to install xdebug, chances are you may find yourself struggling to follow instructions in xdebug documentation with no luck for hours.
First don't try any manual way to install x-debug for php 5.3. Just let the package manager to do the stuff for you. Install it via "php5-xdebug" package by this command and then restart the Apache:
$ sudo apt-get install php5-xdebug $ sudo /etc/init.d/apache2 restart
Check your phpinfo() output and you should see this indicating that xdebug has been installed.
It's not going to be as easy as it went with xdebug for php 5.3. First download the source file of the xdebug. then extract it into a folder. Prior to configuring files for compilation first we need to run "phpize" on the source files. The key concept here is to use the correct version of "phpize". to find the "phpize" for your php 5.2 just run this command:
$ sudo find / -name "phpize"
And locate the file related to your php 5.2 instillation. in my case it was in "/opt/php5.2/bin/phpize". ok now that we have the path to "phpize" let's run it on the xdebug source files.
$ cd xdebug-2.2.1/ $ sudo /opt/php5.2/bin/phpize
You should get this output. If you see other numbers for API versions it means the "phpize" is not for php 5.2.17
Configuring for: PHP Api Version: 20041225 Zend Module Api No: 20060613 Zend Extension Api No: 220060519
Now we need to find the configuration file location for php 5.2. a simple search like this will lead you to the right path for me it was "/opt/php5.2/bin/php-config"
$ sudo find / -name "php-config"
Once you find the php config file path run these commands to configure the xdebug setup then make and install the xdebug.
$ sudo ./configure --enable-xdebug --with-php-config=/opt/php5.2/bin/php-config $ sudo make $ sudo make install
It may take a few seconds and when you are done you will be presented with path of a directory that contains "xdebug.so" file. (I have highlighted that in the screenshot. The path starts with "Installing shared extensions:"). copy that path open your php.ini
insert that path concatenated with xdebug.so file name in your php.ini to finish this process.
Time to restart your web server. if you check the phpinfo() for php 5.2 sites you will notice the xdebug installation notes as shown in the first picture.