Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Steps to reproduce
- Create a directory for config files to live in.
- Adjust settings.php to use that directory.
$config_directories = array( CONFIG_SYNC_DIRECTORY => 'some/valid/path', );
- Visit the site in your browser to begin the install.
- Immediately encounter error:
Drupal\Core\Database\ConnectionNotDefinedException: The specified database connection is not defined: default in Drupal\Core\Database\Database::openConnection() (line 366 of core/lib/Drupal/Core/Database/Database.php).
Drupal\Core\Database\Database::openConnection('default', 'default')
Drupal\Core\Database\Database::getConnection()
Drupal\Core\Config\BootstrapConfigStorageFactory::getDatabaseStorage()
Drupal\Core\Config\BootstrapConfigStorageFactory::get()
install_begin_request(Object, Array)
install_drupal(Object)
If you comment out that definition in settings.php, the installer works fine.
Comment | File | Size | Author |
---|---|---|---|
#16 | 2582475-2-16.patch | 2.69 KB | alexpott |
#16 | 13-16-interdiff.txt | 1.24 KB | alexpott |
#13 | 2582475-2-13.patch | 2.57 KB | alexpott |
#13 | 9-13-interdiff.txt | 1.43 KB | alexpott |
#9 | 2582475-9.patch | 1.82 KB | alexpott |
Comments
Comment #2
kevin.dutra CreditAttribution: kevin.dutra at Workday, Inc. commentedComment #3
afoster CreditAttribution: afoster commentedNot sure if it's related but I had to prepend CONFIG_SYNC_DIRECTORY with a dot to get it working.
$config_directories = array(
CONFIG_SYNC_DIRECTORY => './some/valid/path',
);
(I only enabled Config Export after a minimal install)
Comment #4
kevin.dutra CreditAttribution: kevin.dutra at Workday, Inc. commented@afoster, I don't think that's related to this particular issue. If I walk through the debugger, it finds the directory just fine, but when it flags it as being valid, something farther down the line gets triggered to do a DB lookup using settings that don't exist yet. (Haven't even reached the language selection step yet, let alone the DB config step.)
Comment #5
michaellenahan CreditAttribution: michaellenahan at erdfisch commentedI just encountered this too.
I put this in my default.settings.php
and when I ran drush site-install, I got this error:
Comment #6
jorgediazhav CreditAttribution: jorgediazhav at Evolving Web commentedAnd have you tried this?
https://www.drupal.org/node/2431247#comment-10426127
It worked for me!
Comment #8
alexpottHere's a fix that allows the install to continue.
Comment #9
alexpottHere's a test.
Comment #11
dawehnerCan we actually throw a more specific exception which we could catch? Not sure whether it matters though
Comment #12
alexpott@dawehner I considered catching the database exception wrapper but then I thought better of it and copied the implementation in DrupalKernel that exists to deal with the early installer...
Ideally the above code would not be in DrupalKernel - but it could be in
InstallerKernel
and we could make it public and then this could just use that.I think I'll explore that as a solution.
Comment #13
alexpottYep this is nicer - @dawehner++
Comment #14
dawehnerNice!!
Comment #15
catchWhy specifically count() and not !empty()?
Could we add a note that this overrides the parent method to change the visibility? I had to look that up to see why we were doing it.
This should either be shorter or be allowed to go over 80 chars - or is that only function summaries?
Let's assert something other than just 200 here since that can be a fatal error.
Comment #16
alexpottThanks for the review @catch
Since these are only docs fixes moving back to rtbc.
Comment #19
catchCommitted/pushed to 8.2.x and cherry-picked to 8.1.x. Thanks!
Comment #21
atomicnation CreditAttribution: atomicnation commentedWhy closed? Issue is persistent on 8.1.10, actual stable version.