3
 bin/magento setup:upgrade
Cache cleared successfully
File system cleanup:
public_html/var/generation/Composer
public_html/var/generation/Magento
public_html/var/generation/Symfony
The directory 'public_html/var/di/' doesn't exist - skipping cleanup
Updating modules:

  [Magento\Setup\Exception]
  Can't run this operation: configuration for DB connection is absent.

setup:upgrade [--keep-generated] [--magento-init-params="..."]

I'm using Centos 6 64 bit server, Magento version 2.1.0, I thought this error was like the previous error so I asked my hosting provider to solve it by referring to that answer. They rerun the command and its output was:

We saved default values for these options: db-engine, db-model, db-init-statements.

And the issue wasn't solved. I am trying to install nosto-magento2 using composer

5

well it says that your di folder is not there in the error. delete the var folder and then run php bin/magento setup:di:compile and make sure it creates a di folder inside var. Then run php bin/magento setup:upgrade. Also check your database connection in app/etc/env.php and the permissions on that file.

Look at these lines in env.php and make sure they are correct:

  array (
    'table_prefix' => '',
    'connection' => 
    array (
      'default' => 
      array (
        'host' => 'localhost',
        'dbname' => 'your_dbname',
        'username' => 'your_user',
        'password' => 'your_pass',
        'active' => '1',

Also make sure your user has access to the database.

Update: that means there still is an error with the di file. run these commands:

rm -rf var/di var/generation/ var/cache and var/page_cache
rm -rf pub/static/frontend pub/static/_requirejs/ pub/static/adminhtml
sudo chmod -R 777 var pub lib app/etc
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy

As a sidenote, your env.php should look like this:

<?php
return array (
  'backend' => 
  array (
    'frontName' => 'login',
  ),
  'install' => 
  array (
    'date' => 'Mon, 14 Mar 2016 16:04:24 +0000',
  ),
  'crypt' => 
  array (
    'key' => 'cc1482148f935ef000f4b0c4bc',
  ),
  'session' => 
  array (
    'save' => 'files',
  ),
  'db' => 
  array (
    'table_prefix' => '',
    'connection' => 
    array (
      'default' => 
      array (
        'host' => 'localhost',
        'dbname' => 'db',
        'username' => 'user',
        'password' => 'pass',
        'active' => '1',
      ),
    ),
  ),
  'resource' => 
  array (
    'default_setup' => 
    array (
      'connection' => 'default',
    ),
  ),
  'x-frame-options' => 'SAMEORIGIN',
  'MAGE_MODE' => 'developer',
  'cache_types' => 
  array (
    'config' => 1,
    'layout' => 1,
    'block_html' => 1,
    'collections' => 1,
    'reflection' => 1,
    'db_ddl' => 1,
    'eav' => 1,
    'config_integration' => 1,
    'config_integration_api' => 1,
    'full_page' => 1,
    'translate' => 1,
    'config_webservice' => 1,
    'compiled_config' => 1,
  ),
);
  • the di error disappeared but the error is still there, and i don't have env, i have env.php containing some array, should i generate env? – Lynob Jun 27 '16 at 19:40
  • @Lynob updated my answer – Claudiu Creanga Jun 27 '16 at 19:43
  • should i remove the compiled and cache? pastebin.com/mnjM75fr – Lynob Jun 27 '16 at 19:46
  • I don't think it will help you in this situation. It is clearly a db connection if you are still getting that error. – Claudiu Creanga Jun 27 '16 at 19:49
  • ok great now that error goes away so i must accept your answer however another error pops up and i was hoping you could help, There are no commands defined in the "setup" namespace. i chmod 777 -R var and pub and env.php, when i run php bin/magento list i get pastebin.com/5QaANQ4Z – Lynob Jun 27 '16 at 20:19

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.