Ubuntu – The Xdebug extension is not loaded. No code coverage will be generated on Ubuntu with Xampp

hudsonphpunitUbuntuxamppxdebug

I have a problem to install xdebug on my Ubuntu Server which is using xampp. I know in Stack Overflow there are several questions about this kind of problem but I did not find any solution.

First this is the output of php --version command:

PHP 5.3.8 (cli) (built: Sep 19 2011 13:29:27)  
Copyright (c) 1997-2011 The PHP Group  
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies  
    with Xdebug v2.2.0, Copyright (c) 2002-2012, by Derick Rethans  

Output of php --ini command:

Configuration File (php.ini) Path: /opt/lampp/etc  
Loaded Configuration File:         /opt/lampp/etc/php.ini  
Scan for additional .ini files in: (none)  
Additional .ini files parsed:      (none)  

Output of php -m command:

[PHP Modules]  
bcmath  
bz2  
calendar  
Core  
ctype  
curl  
date  
dba  
dom  
ereg  
exif  
fileinfo  
filter  
ftp  
gd  
gettext  
hash  
iconv  
imap  
intl  
json  
ldap  
libxml  
mbstring  
mcrypt  
memcache  
mhash  
ming  
mssql  
mysql  
mysqli
mysqlnd  
ncurses  
openssl  
pcntl  
pcre  
PDO  
pdo_mysql  
pdo_pgsql  
pdo_sqlite  
pgsql  
Phar  
posix  
radius  
Reflection  
session  
shmop  
SimpleXML  
soap  
sockets  
SPL  
SQLite  
sqlite3  
standard  
sybase_ct  
sysvsem  
sysvshm  
tokenizer  
wddx  
xdebug  
xml  
xmlreader  
xmlwriter  
xsl  
zip  
zlib  

[Zend Modules]  
xdebug  

When I paste the output of phpinfo() in http://xdebug.org/wizard.php, the site shows the following:

Tailored Installation Instructions

Summary

  • Xdebug installed: 2.2.0
  • Server API: Command Line Interface
  • Windows: no
  • Zend Server: no
  • PHP Version: 5.3.8
  • Zend API nr: 220090626
  • PHP API nr: 20090626
  • Debug Build: no
  • Thread Safe Build: no
  • Configuration File Path: /opt/lampp/etc
  • Configuration File: /opt/lampp/etc/php.ini
  • Extensions directory: /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626
  • You're already running the latest Xdebug version

    But here are the instructions anyway:

    … … … (lines truncated) … … …

    I write this on my /opt/lampp/etc/php.ini at the bottom:

    [xdebug]  
    zend_extension = /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so  
    xdebug.profiler_output_dir = "/tmp/xdebug"  
    xdebug.profiler_enable = On  
    xdebug.remote_enable = On  
    xdebug.remote_host = "localhost"  
    xdebug.remote_port = 10000  
    xdebug.remote_handler = "dbgp"  
    

    Output of phpunit --version is as follows:

     PHPUnit 3.6.11 by Sebastian Bergmann.  
    

    Now my actual problem arises:

    When I use the following command it shows that xdebug is not installed:

    phpunit --coverage-html ~/build/logs/coverage  
    

    This command's output is as follows:

    The Xdebug extension is not loaded. No code coverage will be generated.  
    

    Best Answer

    Not sure if it helps but...

    I had the same error when going through the phpunit tutorial - getting the error at chapter 7. http://phpunit.de/manual/current/en/organizing-tests.html

    Took me a while to realise xdebug was set up in /etc/php5/apache2/php.ini but not in /etc/php5/cli/php.ini.

    Worked okay for me after copying the xdebug settings from apache2 to cli.

    Related Topic