# How to downgrade PHPUnit to 4.8.0?

**URL:** <https://discuss.circleci.com/t/how-to-downgrade-phpunit-to-4-8-0/5313>\
**Category:** Build Environment\
**Tags:** php\
**Created:** [July 26, 2016, 6:58am UTC](https://discuss.circleci.com/t/how-to-downgrade-phpunit-to-4-8-0/5313 "2016-07-26T06:58:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tuwannu](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/tuwannu/32/13547_2.png) [@tuwannu](https://discuss.circleci.com/u/tuwannu)\
**Post date:** [July 26, 2016, 6:58am UTC](https://discuss.circleci.com/t/how-to-downgrade-phpunit-to-4-8-0/5313/1 "2016-07-26T06:58:49Z")

</div>

My project runs on PHP 5.5 and thus we are using this in `circle.yml`:

```
machine:
   php:
     version: 5.5.31

```

I am getting this error while running `phpunit`:

```
$ phpunit
This version of PHPUnit requires PHP 5.6; using the latest version of PHP is highly recommended.

phpunit returned exit code 1

```

I don’t have any plans to upgrade my project to PHP 5.6 yet. Is there anyway I can change the phpunit version to the one that supports 5.5, i.e. phpunit 4.8.0 and how?

---

<div class="post-metadata">

**Author:** ![drazisil](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/drazisil/32/24029_2.png) [@drazisil](https://discuss.circleci.com/u/drazisil)\
**Post date:** [July 26, 2016, 7:15am UTC](https://discuss.circleci.com/t/how-to-downgrade-phpunit-to-4-8-0/5313/2 "2016-07-26T07:15:01Z")

</div>

I would advise removing phpunit and then installing the version you need in your dependencies section on circle.yml.

The directions to install a certain version are here: [http://askubuntu.com/questions/428772/how-to-install-specific-version-of-some-package/428778](http://askubuntu.com/questions/428772/how-to-install-specific-version-of-some-package/428778)

```
dependencies:
  pre:
    - sudo apt-get install package=<version>

```

You can also use Composer: [https://phpunit.de/manual/current/en/installation.html](https://phpunit.de/manual/current/en/installation.html)

---

<div class="post-metadata">

**Author:** ![tuwannu](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/tuwannu/32/13547_2.png) [@tuwannu](https://discuss.circleci.com/u/tuwannu)\
**Post date:** [July 26, 2016, 7:28am UTC](https://discuss.circleci.com/t/how-to-downgrade-phpunit-to-4-8-0/5313/3 "2016-07-26T07:28:38Z")

</div>

Thanks! This is what I’m doing. I did not remove and install a different version. But downloaded the target version into the working directory and run from there.

```
machine:
   php:
     version: 5.5.31
dependencies:
  post:
    - wget https://phar.phpunit.de/phpunit-old.phar
    - chmod +x phpunit-old.phar
    - mv phpunit-old.phar phpunit
test:
  override:
    - mkdir -p $CIRCLE_TEST_REPORTS/phpunit
    - ./phpunit --log-junit $CIRCLE_TEST_REPORTS/phpunit/junit.xml

```

It’s working great.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [June 18, 2018, 11:38am UTC](https://discuss.circleci.com/t/how-to-downgrade-phpunit-to-4-8-0/5313/4 "2018-06-18T11:38:32Z")

</div>

Closed on June 18, 2018, 11:38am UTC


