You are here

How to install Xdebug on Centos 6.x?

posted on 2016-01-20

If you have PHP version 5.4 above, you may install Xdebug with a package installer as described below. If you have a PHP version lower than 5.4, you'll have to compile the Xdebug (see instruction below).

Install Xdebug with Package Installer - PHP v5.4+

By installing Xdebug, the xdebug.so shared object will be placed in the /usr/lib64/php/modules folder. Edit php.ini, and restart Apache. (see below).

Compile Xdebug - PHP v5.3.x or below

1. Download the Xdebug from that is compatible with your PHP version.
2. Place the xdebug-X.Y.Z.tgz in the /usr/src, and unpack with
"tar xfz xdebug-X.Y.Z.tgz".
3. Change directory to "xdebug-X.Y.Z".
4. Run "phpize". This prepares the environment to compile.
5. Run "./configure".
6. Run "make". The compiled object will be placed in /usr/src/
xdebug-X.Y.Z/modules folder. The name of the shared object is xdebug.so.

Edit php.ini and restart Apache

1. Locate the php.ini file (on Centos, it is located in /etc/php.ini).
2. Add the following line under the Extensions section.
zend_extension="/usr/lib64/php/modules/xdebug.so"
3. Restart apache. (i.e. service httpd restart).
4. Verify phpinfo to ensure xdebug is loaded properly.

You may also verify your Xdebug installation by calling PHP in the command-line.