12

When I try to upgrade Magento 2 php bin/magento setup:upgrade I get

I get

[Magento\Setup\Exception]
Can't run this operation: deployment configuration is absent. Run 'magento setup:config:set --help' for options. setup:upgrade

[--keep-generated] [--magento-init-params="..."]

How to fix it? Updating using the web updater gives the following errors:

enter image description here

I asked my hosting provider to fix them and they did install the right php version 5.6 and all extensions recommended by magento and created a cron job but I still see the error.


UPDATE: (from comments)
env.php wasn't there, when I run magento setup:config:set I get this error:

$ bin/magento setup:config:set
SQLSTATE[HY000] [2002] No such file or directory

[InvalidArgumentException]
Parameter validation failed

  • 1
    Check to see if <magento install dir>/app/etc/env.php is present. That is the deployment configuration. If it's absent, run the magento setup:config:set command again to create it. – Steve Johnson Jun 22 '16 at 0:16
  • @SteveJohnson env.php wasn't there, when I run magento setup:config:set i get this error pastebin.com/BDzxYGGU – Lynob Jun 22 '16 at 7:51
  • The error indicates your Magento database user name and password don't match. I'm not sure it's a good idea to run your Magento database as root; have you seen our MySQL setup instructions? Maybe try that and see if the command succeeds. – Steve Johnson Jun 22 '16 at 22:33
5

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.

29

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.

  • In my case this was the issue, app/etc/env.php was present but app/etc/config.php was not. – Niels Oct 4 '18 at 8:49
  • I have both app/etc/env.php and app/etc/config.php still having this error.. – Ajwad Taqvi Apr 15 at 11:04
3

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.

2

First you nedd to deploy your website.The first Check all folder in the .htaccess file is available after

php bin/magento setup:upgrade

and

php bin/magento setup:static-content:deploy

or pub > static file checked not static folder so create static folder and index.php in Pub file. index.php not avilble so please copy your other project and peast

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.