PHP Fatal error: Uncaught Error: Class 'Dotenv\Dotenv' not found

UPDATE:

Composer 1.6.2 is out which fixes this bug. If you re-provision your server you should get the new version. If you made the edits originally listed below, remove them first.

Your main config should have this setting:

# group_vars/all/main.yml
composer_keep_updated: true
  1. reprovision your server (ansible-playbook server.yml -e env=<environment> --tags "composer")
  2. re-deploy your site

For development, run this: ANSIBLE_TAGS=composer vagrant provision.


Old details:

Summary

To sum this issue up:

Composer 1.6.1 came out and apparently has an autoload bug.

The solution in Trellis is to pin the Composer version to the last release and turn off the auto-update feature.

# group_vars/all/main.yml
composer_keep_updated: false
composer_version: 1.5.6

Add this to group_vars/all/main.yml.

Then do the following for remote servers

  1. reprovision your server (ansible-playbook server.yml -e env=<environment> --tags "composer")
  2. re-deploy your site

For development, run this: ANSIBLE_TAGS=composer vagrant provision.

10 Likes