How to fix this Error No code coverage driver is available

coverage
docker
config
php7.1

#1

I’m configuring this for PHP and Laravel using CircleCI v2.

I’m getting this error in:

 - run:
          name: Run Unit tests
          command: vendor/bin/phpunit

I read about, and some people say that it was because of php xdebug. I was able to install php-xdebug, and the next step is about configuring php.ini which I’m unable to find, I run php --ini and get the following:

#!/bin/bash -eo pipefail
php --ini
Configuration File (php.ini) Path: /usr/local/etc/php
Loaded Configuration File:         (none)
Scan for additional .ini files in: /usr/local/etc/php/conf.d
Additional .ini files parsed:      /usr/local/etc/php/conf.d/docker-php-ext-mcrypt.ini,
/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini,
/usr/local/etc/php/conf.d/docker-php-ext-zip.ini

and what I understand is that I have none php.ini file, after some more reading, someone clarify that php uses a php.ini file and apache uses another php.ini file, and that maybe apache is not installed, so I run apachectl -V && whereis apache2 and everything looks good.

I really want to set up the code coverage here, this is only for educational porpuses and the project will be open to any after done, so others can learn.


#2

Can you show me a build URL please?


#3

Hi levlaz, the build url is this one, https://circleci.com/gh/corderogerardo/customCMS/48 , but I don’t know if you’re able to see it, everything is working except the code coverage.

I let you some images about the problem:


#4


#5

You just need to install xdebug.


#7

I already have installed php-xdebug. What I read was that after installation you need to configure it in php.ini file, which I can not find to do it, as I showed in the images, Do you have an example for this kind of projects setup with the code coverage?


#8

It depends on the version of PHP you’re using, and the image you’re using.

https://xdebug.org/docs/install

The official Docker Hub PHP image allows this:

pecl install xdebug && docker-php-ext-enable xdebug

#9

Thank you very much Rohara, this was the solution I needed!


#10

I’m having the same issue:

No code coverage driver is available

I have tried commands with no lucky:

pecl install xdebug && docker-php-ext-enable xdebug
pecl/xdebug is already installed and is the same as the released version 2.5.5
install failed
Exited with code 1

and

docker-php-ext-enable xdebug
/usr/local/bin/docker-php-ext-enable: 98: /usr/local/bin/docker-php-ext-enable: cannot create /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini: Permission denied
Exited with code 2

but xdebug seems to be not enabled:

#!/bin/bash -eo pipefail
php -m
[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
ftp
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib

[Zend Modules]

Am I doing something wrong?
Thanks


#11

Try sudo docker-php-ext-enable xdebug


#12

@rohara Thanks, this is working.


#13