Installing xdebug in XAMPP 1.8.3 on Linux

If you have installed XAMPP 1.8.3-0 for Linux and you want to install x-debug here is how to do it using PECL.

1.) Check to make sure /bin is in your path

echo $PATH;

if :/bin: is in the path then bin is in your path. This makes sure that when you create a symbolic link in /bin it can be called from any directory at the prompt.

If it is not in your path you may have your bin directory configured to a different location.

2.) Create a symbolic link to phpize in /bin

cd /bin
sudo ln -s /opt/lampp/bin/phpize-5.5.1 phpize

3.) Test phpize

cd /
sudo phpize -v

you should get something like this:

Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 22012121

4.) Install autoconfig

sudo yum install autoconf

5.) Find php tools for building extensions

yum search php-dev

php-devel.x86_64 : Files needed for building PHP extensions

if this does not find an entry with "Files needed for building PHP extensions" then you need to do some web searches to figure out how to install the appropriate package.

6.) Install php tools for building extensions

yum install php-devel.x86_64

5.) Install gcc compiler

sudo yum groupinstall "Development Tools"

6.) Install x-debug using pecl

cd /opt/lampp
pecl install xdebug

7.) Edit php.ini

sudo vi "$(cd /opt/lampp/; sudo find `pwd` -name php.ini;)"

This finds the path to php.ini file under /opt/lampp and then opens it in the text editor vi, if your php.ini file is not under /opt/lamp then change /opt/lamp to the location of xampp where you have it installed. If you're confused by Linux voodoo then just find the php.ini file your self go to that directory and type in sudo vi php.ini .

8.) In the text editor vi that has opened php.ini edit the configuration

a.) Find extension section by typing the following:

/zend_extension
i

Note: "/" is for search for string and "i" is for insert which puts you into editing mode.

b.) Add in line at the bottom of the extension section

;[zend extensions]
zend_extension="/opt/lampp/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"

xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.show_local_vars=1
xdebug.remote_log=/opt/lampp/logs/xdebug.log

Remove tabs (\t) at the front when you copy and paste this section in. Other words left justify it.

If your version of xampp is not installed at /opt/lampp then replace /opt/lampp with your directory

Note: I had to adjust my Net Beans install to use port 9001 in the settings above (see https://netbeans.org/bugzilla/show_bug.cgi?id=176335). I have left the setting above of remote_port to 9000 because that is the norm in most cases.

c.) Add in the xdebug configuration

escape key
:x

d.) Type the following

escape key
:x

9.) Restart the server

sudo /opt/lampp/lampp restart

If your version of xampp is not installed at /opt/lampp then replace /opt/lampp with your directory

10.) Done

Tested on Red Hat 6.x

If this does not work for you then I found this tool to be useful:

http://xdebug.org/wizard.php

comments powered by Disqus