When installing the second site in a multi-site shared table site the installer errors when the shared tables are reached.

To reproduce Create a single database for Drupal and setup to separate site's folder.
Example. sitea.local and siteb.local

in the settings.php for sitea.local add the following (as well as your DB settings)

$db_prefix = array(
    'default'     => 'sitea_',
    'users'        => 'shared_',
    'sessions'   => 'shared_',
    'role'           => 'shared_',
    'authmap'   => 'shared_',
);

Run the installer by navigating to http://sitea.local/install.php

In the settings.php file for siteb.local add the following (as well as the same DB settings as site a)

$db_prefix = array(
    'default'     => 'siteb_',
    'users'        => 'shared_',
    'sessions'   => 'shared_',
    'role'           => 'shared_',
    'authmap'   => 'shared_',
);

Run the installer by navigating to http://siteb.local/install.php

Comments

Damien Tournoud’s picture

Well, install and update don't support shared tables. You will have to install without the prefixes and *then* install them. Same mechanism for updates.

jredding’s picture

yes that's understood but under D5 and D6 you didn't have to do this, so this is new to D7.

alexanderpas’s picture

Title: Fatal error when installing multi-site shared table sites. » [multisite] Fatal error when installing shared table sites.

actually, this bug has been introduced somewhere in D6, D5 was working.

still i'm severly against the following install path!

first site:
0) setup database connection string
1) setup tables prefixes before install.
2) setup drupal as usual.

all following sites:
0) setup database connection string
1) do not setup tables prefixes before install.
2) install with a free table prefix.
3) setup tables prefixes after install.
4) remove unneeded tables
- if you remove one table too much, restart from 1

since, in drupal 5 the following was enough for all setups.
0) setup database connection string
1) setup tables prefixes before install.
2) setup drupal as usual (ignoring warnings about table already existing).

Anonymous’s picture

wow, just came across this in drupal 6.

will test if this is still the case in drupal 7, and if so, work on a fix.

cjscullyca’s picture

This really should be fixed in D6 as well. Settings.php has a whole instruction and example using prefixes of "main_" and "shared_" and nothing that says "using shared tables will break installs and updates for the additional sites in a multisite set up" There have been some interesting arguments in other threads about whether or not dot prefixes like databasename.tablename for mysql or schemaname.tablename for pgsql are "officially supported" so I decided not to press my luck with those and use the type of prefixing that seems to be officially supported only to find that it doesn't work either!

PLEASE either get the software working the way your documentation says it should work or change your documentation to make it clear that the only way to do this stuff is to hack the code.

alexanderpas’s picture

Title: [multisite] Fatal error when installing shared table sites. » Fatal error when installing shared table sites.
Issue tags: +multi-site