Can’t tun PHPUnit as it says “PHPUnit requires PHP 5.6”, but I have 4.2 installed

I’ve been stuck on this for around 4hrs now. I’m trying to run some tests on my Laravel 5 project. They worked a month or so ago when I ran them last, but I’m wanting to run them again. Just FYI, I’m using Vagrant.

Here’s a snippet from my composer.json file.

"require": {
    "laravel/framework": "5.0.*",
    "illuminate/html": "^5.0",
    "doctrine/dbal": "~2.5",
    "maatwebsite/excel": "~2.0.0",
    "zizaco/entrust": "dev-laravel-5",
    "kalnoy/nestedset": "^3.0"
"require-dev": {
    "phpunit/phpunit": "4.2.*",
    "phpspec/phpspec": "~2.1"

But whenever I run phpunit through the terminal, it states

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

I’ve tried the below – all found via Google and Stack Overflow.

  • the composer clear-cache command
  • reloading vagrant
  • changing versions (4.0, ~4.0, 4.8, 4.1.*)
  • adding “cache-files-ttl”: 0 to my composer.json

Entering in the below all return the same error message about PHP 5.6

  • phpunit –check-version
  • phpunit –self-update
  • phpunit

For what it’s worth, /vendor/phpunit/composer.json shows

"require": {
    "php": ">=5.3.3",
"extra": {
    "branch-alias": {
        "dev-master": "4.2.x-dev"

Also, calling php -v shows “PHP 5.4.45 (cli) (built: Sep 4 2015 15:40:44)”. phpinfo() shows the same thing.

Any ideas what’s going on here!?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s