Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add XDebug zend_extension to php.ini?

Tags:

php

xdebug

I have a VPS with cPanel WHM and am trying to enable XDebug. I installed the extension by going to WHM -> Software -> Module Installers -> PHP Pecl -> Manage and I confirmed it's installed by checking my phpinfo() page.

The next step is to enable XDebug in my php.ini file, but I'm a little confused how I should go about doing this.

Looking at php.ini in /usr/local/lib, I see this line at the bottom:

zend_extension="/usr/local/Zend/lib/Guard-6.0.0/php-5.4.x/ZendGuardLoader.so"

However, in WHM -> Service Configuration -> PHP Configuration Editor, there's a "zend_extension" option with this value:

/usr/local/IonCube/ioncube_loader_lin_5.4.so, /usr/local/Zend/lib/Guard-6.0.0/php-5.4.x/ZendGuardLoader.so

So my question is, how should I go about adding the path to XDebug:

/usr/local/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so

To php.ini? I see three ways of doing it and I don't know which is correct:

  1. I could add it to the comma separated list in WHM
  2. I could add it in php.ini directly, putting a comma between it and the existing value
  3. I could put it on a new line in php.ini

Which way is correct?

like image 905
Nate Avatar asked Dec 15 '22 21:12

Nate


1 Answers

Highly depends on the PHP configuration (./configure). PHP will look in the default extension path for your xdebug.so extension; in which case you don't need to specify any path:

zend_extension = xdebug.so

Regarding new line and comma, I prefer new line because it makes it easier to remove an extension later on. My php.ini looks like this (example):

extension      = memcached.so
extension      = zopfli.so
zend_extension = opcache.so
zend_extension = xdebug.so

Notice the alphabetical order as well.

like image 102
Fleshgrinder Avatar answered Dec 17 '22 09:12

Fleshgrinder