5

I get this error after install when trying to clear var/ generation, and static content deploy via command line.

[Exception] Warning: Invalid argument supplied for foreach() in /vendor/magento/module-store/Model/Config/Processor/Fallback.php on line 125
6
  • Try upgrade command... Bin/magento setup:upgrade then di:compile and static-content:deploy Commented Apr 12, 2017 at 18:47
  • I get an error that it can't create the directory. Permissions/ Ownership? Commented Apr 12, 2017 at 19:40
  • Well for now just set 777 permission to all directories. After that you can set permission as per security concerns. Commented Apr 12, 2017 at 19:46
  • Still same error message. Commented Apr 12, 2017 at 20:24
  • You are on local machine with Ubuntu?if yes take a look here magento.stackexchange.com/a/98699/51548 Commented Apr 13, 2017 at 2:29

2 Answers 2

6

The problem was in app/etc/env.php file which was empty.

I restored the content of this file with the local data and it started working again.

0

This can happen when trying to build a magento site when the DB is not reachable and the config file doesn't have any stores set.

You should be able to run php bin/magento app:config:dump on a working instance to see what app/etc/config.php and app/etc/env.php should look like. The minimum we have got it to is: app/etc/config.php

<?php
return array(
    'modules' =>
        array(
            ...
        ),
    'scopes' =>
        array(
            'websites' =>
                array(
                    'admin' =>
                        array(
                            'website_id' => '0',
                            'code' => 'admin',
                            'name' => 'Admin',
                            'sort_order' => '0',
                            'default_group_id' => '0',
                            'is_default' => '0',
                        ),
                    'uk' =>
                        array(
                            'website_id' => '2',
                            'code' => 'uk',
                            'name' => 'United Kingdom',
                            'sort_order' => '2',
                            'default_group_id' => '2',
                            'is_default' => '1',
                        ),
                ),
            'groups' =>
                array(
                    0 =>
                        array(
                            'group_id' => '0',
                            'website_id' => '0',
                            'code' => 'default',
                            'name' => 'Default',
                            'root_category_id' => '0',
                            'default_store_id' => '0',
                        ),
                    2 =>
                        array(
                            'group_id' => '2',
                            'website_id' => '2',
                            'code' => 'united_kingdom_group',
                            'name' => 'United Kingdom',
                            'root_category_id' => '1838',
                            'default_store_id' => '2',
                        ),
                ),
            'stores' =>
                array(
                    'admin' =>
                        array(
                            'store_id' => '0',
                            'code' => 'admin',
                            'website_id' => '0',
                            'group_id' => '0',
                            'name' => 'Admin',
                            'sort_order' => '0',
                            'is_active' => '1',
                        ),
                    'uk' =>
                        array(
                            'store_id' => '2',
                            'code' => 'uk',
                            'website_id' => '2',
                            'group_id' => '2',
                            'name' => 'United Kingdom',
                            'sort_order' => '0',
                            'is_active' => '1',
                        ),
                ),
        ),
);

app/etc/env.php

<?php
return array (
  'system' => 
  array (
    'default' => 
    array (
      'dev' => 
      array (
        'js' => 
        array (
          'minify_files' => '1',
          'merge_files' => '0',
          'enable_js_bundling' => '0',
        ),
        'css' => 
        array (
          'merge_css_files' => '0',
          'minify_files' => '0',
        ),
      ),
    ),
  ),
  'cache_types' => 
  array (
    'compiled_config' => 1,
  ),
);

You will need to update app/etc/config.php to match your store information, list can be obtained from the db tables:
- store
- store_group
- store_website

Hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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