How to install Xdebug on Centos 6.x?

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+

1. yum update
2. yum install php-devel gcc gcc-c++ autoconf automake
3. yum install php-pear
4. pecl install Xdebug

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.

% php -v
PHP 5.3.3 (cli) (built: Jul  9 2015 17:39:00)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Xdebug v2.2.7, Copyright (c) 2002-2015, by Derick Rethans

Comments

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.