# Warning: xdebug.mode=coverage has to be set in php.ini

**URL:** <https://travis-ci.community/t/warning-xdebug-mode-coverage-has-to-be-set-in-php-ini/10919>\
**Category:** PHP\
**Created:** [December 26, 2020, 3:04pm UTC](https://travis-ci.community/t/warning-xdebug-mode-coverage-has-to-be-set-in-php-ini/10919 "2020-12-26T15:04:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![maurobonfietti](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/maurobonfietti/32/5929_2.png) [@maurobonfietti](https://travis-ci.community/u/maurobonfietti)\
**Post date:** [December 26, 2020, 3:04pm UTC](https://travis-ci.community/t/warning-xdebug-mode-coverage-has-to-be-set-in-php-ini/10919/1 "2020-12-26T15:04:31Z")

</div>

Hi guys,

My build fail when I run:

```bash
phpunit --coverage-clover clover.xml

php-coveralls --coverage_clover=clover.xml -v

```

I see this error/warning:

`Warning: xdebug.mode=coverage has to be set in php.ini`

 ![Screen Shot 2020-12-26 at 11.57.28](https://us1.discourse-cdn.com/flex015/uploads/travis_ci/original/2X/6/6d32797fbe9fcf46dfb83343b5d6ae2dcfc4a3f0.png)

I tried to add the `XDEBUG_MODE=coverage` in `.travis.yml` but it’s still failing.

For example:

```auto
env:
  global:
    - XDEBUG_MODE=coverage

...

script:
  - XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-clover clover.xml
  - vendor/bin/php-coveralls --coverage_clover=clover.xml -v

```

Job Failed Example:

> **[Travis CI - Test and Deploy with Confidence](https://travis-ci.com/github/maurobonfietti/slim4-api-skeleton/jobs/464503083)**

Any ideas?  
Thank you 🙂

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [December 26, 2020, 6:07pm UTC](https://travis-ci.community/t/warning-xdebug-mode-coverage-has-to-be-set-in-php-ini/10919/2 "2020-12-26T18:07:41Z")

</div>

The message is pretty clear:

```auto
  coverage_clover XML file is not readable: /home/travis/build/maurobonfietti    
  /slim4-api-skeleton/clover.xml                                                 

```

and indeed, [there’s no such file in the commit being built](https://github.com/maurobonfietti/slim4-api-skeleton/tree/ff7c7080c91611108c0f4dd13694ae6219f25ae5).

---

<div class="post-metadata">

**Author:** ![maurobonfietti](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/maurobonfietti/32/5929_2.png) [@maurobonfietti](https://travis-ci.community/u/maurobonfietti)\
**Post date:** [December 26, 2020, 6:38pm UTC](https://travis-ci.community/t/warning-xdebug-mode-coverage-has-to-be-set-in-php-ini/10919/4 "2020-12-26T18:38:33Z")

</div>

Hi @native-api!

The `clover.xml` file it’s generated on demand by the previous command:

`phpunit --coverage-clover clover.xml`

but for some reason, when I running PHPUnit to generate the code coverage

PHPUnit in Travis show me a warning: `"xdebug.mode=coverage has to be set in php.ini"`.

So the file `clover.xml` it is not generated, and the next command `php-coveralls` finish with error.

I tried to add an environment variable, `XDEBUG_MODE=coverage`, to enable xdebug.mode in Travis CI but still not working for me right now…

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [December 26, 2020, 6:56pm UTC](https://travis-ci.community/t/warning-xdebug-mode-coverage-has-to-be-set-in-php-ini/10919/6 "2020-12-26T18:56:34Z")

</div>

[`XDEBUG_MODE` support in `php-code-coverage`](https://github.com/sebastianbergmann/php-code-coverage/issues/834) is [new (or reintroduced) in `9.2.4`](https://github.com/sebastianbergmann/php-code-coverage/commit/0a7f0acf9269c190fd982b5c04423feae986b6e0).

---

<div class="post-metadata">

**Author:** ![maurobonfietti](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/maurobonfietti/32/5929_2.png) [@maurobonfietti](https://travis-ci.community/u/maurobonfietti)\
**Post date:** [December 26, 2020, 6:57pm UTC](https://travis-ci.community/t/warning-xdebug-mode-coverage-has-to-be-set-in-php-ini/10919/7 "2020-12-26T18:57:38Z")

</div>

Well, I set a specific version of PHP in travis.yml

```auto
php:
  - '7.3.24'
  - '7.4.0'

```

and now it’s working!  
Best Regards,  
Thanks!!

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [December 26, 2020, 7:12pm UTC](https://travis-ci.community/t/warning-xdebug-mode-coverage-has-to-be-set-in-php-ini/10919/8 "2020-12-26T19:12:11Z")

</div>

> [@maurobonfietti](#):
>
> Well, I set a specific version of PHP in travis.yml
> 
> ```auto
> php:
> - '7.3.24'
> - '7.4.0'
> 
> ```

[Those older versions come without XDebug 3](https://travis-ci.community/t/xdebug-3-is-installed-by-default-breaking-builds/10748/5), sidestepping the issue with `php-code-coverage`.
