magento setup:upgrade error "deployment configuration is absent"

This error message is also shown if your app/etc/config.php is missing. If app/etc/env.php is present and you are still seeing this issue, check for app/etc/config.php. If it is not present, Magento can create it by running bin/magento module:enable --all. This will recreate the file. Then, try running bin/magento setup:upgrade again.


I ran into the same issue today. It appeared that the app/etc/env.php was missing. This means that Magento was not yet installed. During Magento installation it will create this file, so:

  • make sure app/etc/ is writable for the magento user/webuser
  • run bin/magento setup:install ...params...

In my case, some script that I made was not copying my env.php file into the app/etc/ folder.

It is also possible that the file is there, but it is not readable for the Magento user/webuser.


In my case, I am using Magento 2 by docker,

I had both app/etc/env.php and app/etc/config.php files. Also had .htaccess file in root folder and still had this error while running any command of magento:

Invalid configuration file: '/var/www/html/app/etc/env.php'

Then,

  1. I killed all running containers with: docker kill $(docker ps -q)
  2. Deleted all stopped containers with: docker rm $(docker ps -a -q)
  3. Deleted all images with: docker rmi $(docker images -q)
  4. Removed all unused volumes with: docker volume prune

4th point is must.

And installed Docker Image for Magento 2 again. This worked for me.