1

I've a strange problem with a project that appeared all of a sudden. When I try to enter the site I get this error:

An error has happened during application run. See exception log for details.
enter code here

When I look in the exception.log:

[2018-03-26 15:15:12] main.CRITICAL: Notice: Undefined index: websites in /var/www/project/www/vendor/magento/module-config/App/Config/Type/System.php on line 248 {"exception":"[object] (Exception(code: 0): Notice: Undefined index: websites in /var/www/project/www/vendor/magento/module-config/App/Config/Type/System.php on line 248 at /var/www/project/www/vendor/magento/framework/App/ErrorHandler.php:61)"} []

This error came out of nowhere and the site is not working. Neither frontend or backend/admin. As you can see it's something related to the cache handling in a core file. I've been struggling for hours with this issue and I'm out of ideas...

I've tried:

  • Developer mode
  • Cleaing/flushing cache
  • Disabled cache
  • Removing www/pub/static/frontend/ www/pub/static/_requirejs/ www/var/cache/ www/var/di/ www/var/generation/ www/var/page_cache/ www/var/view_preprocessed/ www/generated/ from disk.
  • Restored database dump from yesterday
  • Removed www/vendor folder and re-ran composer install and composer update
  • Re-installed Magento with the setup CLI command
  • Re-created www/app/etc/env.php to make sure it's not corrupted
  • Turned off opcache in php.ini

I'm using Magento 2.2.3 with Nginx, MySQL and Ubuntu 16.04. I'm not using redis or varnish.

The Magento CLI is working and no exceptions are thrown.

Any ideas guys?

  • Do you have third-party modules? – Stepan Furman Mar 26 '18 at 18:49
  • Yeah I have but they have been working flawless since today. No recent updates or so. Might be an alternative to disable them to see if that helps but I doubt that's the issue... – utklasad Mar 26 '18 at 19:45
  • Ok, did you tried just simply xdebug this issue? Set breakpoint at /var/www/project/www/vendor/magento/module-config/App/Config/Type/System.php on line 248 and look to the stack trace, check variables values... – Stepan Furman Mar 26 '18 at 19:48
  • Yeah its breaking because it can't load some global variables. Variables that supposed to have a value is null instead for some unknown reason. I just fixed the issue by checking out the repo again in a clean folder then re-installed Magento with composer - now it's working. So there must be some corrupt files that's untracked in git and not in the vendor catalog... Really strange but now its working with a complete new installation... Thanks for the help! – utklasad Mar 27 '18 at 7:35
0

To me it was solved when I ran:

php bin/magento setup:di:compile
0

I needed clear my app/etc/env.php.

My env.php file:

<?php
return array (
    'backend' =>
        array (
            'frontName' => 'sacadmin',
        ),
    'crypt' =>
        array (
            'key' => 'ab43d966a6cab0add849980ece1b3fa5',
        ),
    'db' =>
        array (
            'table_prefix' => '',
            'connection' =>
                array (
                    'default' =>
                        array (
                            'host' => 'localhost',
                            'dbname' => 'dbname',
                            'username' => 'root',
                            'password' => 'root',
                            'model' => 'mysql4',
                            'engine' => 'innodb',
                            'initStatements' => 'SET NAMES utf8;',
                            'active' => '1',
                        ),
                ),
        ),
    'resource' =>
        array (
            'default_setup' =>
                array (
                    'connection' => 'default',
                ),
        ),
    'x-frame-options' => 'SAMEORIGIN',
    'MAGE_MODE' => 'developer',
    'session' =>
        array (
            'save' => 'files',
        ),
    'cache_types' =>
        array (
            'config' => 1,
            'layout' => 1,
            'block_html' => 1,
            'collections' => 1,
            'reflection' => 1,
            'db_ddl' => 1,
            'eav' => 1,
            'customer_notification' => 1,
            'config_integration' => 1,
            'config_integration_api' => 1,
            'full_page' => 1,
            'translate' => 1,
            'config_webservice' => 1,
            'compiled_config' => 1,
        ),
    'install' =>
        array (
            'date' => 'Fri, 01 Jun 2018 23:50:13 +0000',
        ),
);

Make sure you change the info for your environment inputs.

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.