The Xdebug extension is not loaded. No code coverage will be generated on Ubuntu with Xampp
Solution 1
It is possible that phpunit uses a different PHP version from the one that you have installed Xdebug for. Try to use php `which phpunit` --coverage-html ~/build/logs/coverage
, if that works, then phpunit uses the wrong PHP by default. This could be a path issue.
Solution 2
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.
Solution 3
See your "php.ini" in the folder "cli" on php5, this not have the lines references for your xdebug. So, add the lines for xdebug.
![Tareq](https://i.stack.imgur.com/3z0Yu.jpg?s=256&g=1)
Tareq
I wrote my first program using Quick Basic just after I passed my (10+2) exam. It was a piano program which made sounds if anyone pressed a key from the keyboard. It was the year 1996. After that, in the year 1999, I wrote my first professional program named “Bangla Type Tutor” by which anyone can learn how to type in Bengali Language using Bijoy Keyboard Layout. I used Visual Basic 6.0 to develop the program. Since then, I have been developing programs which help various people in their practical business life. I have a numerous number of accounting software written in PHP and Visual Basic dot NET. I can work with a team or individually in self-motivated friendly environment.
Updated on June 08, 2022Comments
-
Tareq about 2 years
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()
inhttp://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.
-
Sharlike about 11 yearsWhat lines should be added?
-
tonix over 9 yearsSorry, what is the purpose of the command ->
php `which phpunit`
? -
sensorario almost 9 yearsThis wirks only if phpunit is symlinked in a system. In example, ...
which cat
could return /bin/cat. In this casewhich phpunit
could return /usr/local/bin/phpunit`. Backticketd (``) instruction are interpreted so the command below is, in real, "$ php /usr/bin/phpunit --coverage-html ...." but the path could change. -
Charaf over 7 yearsThis doesn't help understanding as it outputs the following :
# php `which phpunit` --coverage-html ./cov Warning: require(PHPUnit/Autoload.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 40 Call Stack: 0.0001 350936 1. {main}() /usr/bin/phpunit:0 Fatal error: require(): Failed opening required 'PHPUnit/Autoload.php' (include_path='.:/usr/local/lib/php') in /usr/bin/phpunit on line 40 Call Stack: 0.0001 350936 1. {main}() /usr/bin/phpunit:0
-
Michiel van der Blonk over 6 yearsWorking on WAMP and I had the exact same problem!