Xdebug for Fedora with PHP 5.3

In February I wrote a guide on setting up Xdebug for Eclipse usage under Ubuntu. Using a neat debugger while exploring an existing WordPress project is a must and among the two possibilities (the Zend one or Xdebug) I use Xdebug.

However, setting it up on my ThinkPad took a bit more time due to the different configuration.

Basically the installation process and the Eclipse configuration is all the same – install php-devel and pecl and then proceed with xdebug install, configure Eclipse further. However, adding the Xdebug support for the PHP has several differences to be taken into account.

First off, if you’re using a 32-bit LAMP platform (such as getting the XAMP version which is 32-bit only) on a 64-bit platform, the default configuration would be a bit problematic. Or, in other words, leading to no Xdebug support. Once Xdebug is installed, you need to pick the correct xdebug.so version corresponding to your platform and PHP version.

You could browse the open source repos for previous versions (if you’re running an older version of PHP), I personally picked Komodo’s repository and downloaded the latest remote debugging client for Linux (x86). In the tar.gz archive there are different .so libs for every popular PHP version so pick the one you use (like, create a PHP page with phpinfo() and see what are you running).

Copy the xdebug.so to a common location (like together with your other modules in the Apache directory) and add the line:

[php] zend_extension=”/opt/lampp/modules/xdebug.so” [/php]

You will need the full absolute path whatever it is (where the .so file is copied).

Restart the web server and check the phpinfo() again, the xdebug should be running there.

P.S. Having more than 1 instance of either Apache or PHP might be a bit confusing. You could find the running Apache (if your localhost is available at the moment) by:

[bash] ps aux | grep httpd [/bash]

(or grep apache). Then, you could restart it with:

[bash] /opt/lamp/bin/httpd -k restart [/bash]

(or whatever the bin is entitled). As for the PHP versions, you could also run different PHPs from the web server and your default console cli call. In the phpinfo() page you could see what the Apache is running at the moment. In your terminal, you could hit:

[bash] which php [/bash]

To see which terminal instance is running and also ‘php -i’ to verify the configuration file used. This is important so that you configure the correct Xdebug settings respectively (instead of editing the incorrect config file).

Leave a Reply

Your email address will not be published. Required fields are marked *