I am trying to convert a D7 website to backdrop.

In D7 I am able to specify a second dB needed by a custom module with these connection parameters in settings.php:

$databases = array (  'default' => array (    'default' => array (      'database' => 'backdrop',      'username' => 'name',      'password' => 'pass',      'host' => 'localhost',      'port' => '',      'driver' => 'mysql',      'prefix' => '',    ),  ),  'kieser' => array (    'default' => array (      'database' => 'kieser',      'username' => 'anothername',      'password' => 'anotherpass',      'host' => 'localhost',      'port' => '',      'driver' => 'mysql',      'prefix' => '',    ),  ), );  

But when I try update.php, I get these errors:

php: PHP Warning:  Undefined variable $database in backdrop/settings.php on line 62 php: PHP Deprecated:  md5(): Passing null to parameter #1 ($string) of type string is deprecated in backdrop/settings.php on line 62 php: PHP Warning:  Undefined variable $database in backdrop/settings.php on line 63 php: PHP Deprecated:  md5(): Passing null to parameter #1 ($string) of type string is deprecated in backdrop/settings.php on line 63

Does anybody have some hints as to how I get this to work in backdrop?

 NB I have read the docs about secondary dBs, but this is a second dB not a secondary one.

Accepted answer

Hi VaughanR.

The issue (seems like a bug) is in these two lines in the settings.php for a "virgin" Backdrop codebase:

$config_directories['active'] = 'files/config_' . md5($database) . '/active'; $config_directories['staging'] = 'files/config_' . md5($database) . '/staging';

Try replacing 'files/config_' . md5($database) . '/active'; with something like

'files/config_[TYPE_ANY_RANDOM_STRING_HERE]/active';

AND

'files/config_[TYPE_THE_SAME_RANDOM_STRING_HERE]/staging';

That will create your config active and staging directories in the location specified in those lines, instead of trying to come up with a unique string by doing md5() on the $database string.

 

Comments

Hi VaughanR.

The issue (seems like a bug) is in these two lines in the settings.php for a "virgin" Backdrop codebase:

$config_directories['active'] = 'files/config_' . md5($database) . '/active'; $config_directories['staging'] = 'files/config_' . md5($database) . '/staging';

Try replacing 'files/config_' . md5($database) . '/active'; with something like

'files/config_[TYPE_ANY_RANDOM_STRING_HERE]/active';

AND

'files/config_[TYPE_THE_SAME_RANDOM_STRING_HERE]/staging';

That will create your config active and staging directories in the location specified in those lines, instead of trying to come up with a unique string by doing md5() on the $database string.

 

Thanks argiepiano very helpful - I should have read the error messages a bit more closely.

So I am over that hurdle, but apparently there are plenty more...

Yes, D7 upgrades can be tricky, especially if there are lots of custom modules or contribs. Keep posting in the Forum if you need help, or ask for help on the Backdrop Zulip channel.