When I already have a "single site" installation or a "multi site" installation with a shared database, how do I add another domain to it? In particular, how can I install an extra set of tables in the shared database to serve the new domain? Of course I know I have to use a prefix, but where is the script to install the new table structure?

Comments

nancydru’s picture

cog.rusty’s picture

Normally
- You create a new directory under /sites, such as /sites/newsite.com or /sites/example.com.subdirectory or /sites/subdomain.example.com, and put a fresh clean settings.php in it
- Browse to your new site's URL (which should point *already* to drupal's installation directory). The installer runs and asks you about the database (the same one) and this site's table prefix (in the "advanced" section). At this point you just set a different prefix, and all tables for this site are created.

To share *some* of the tables you edit settings.php and follow the advice in http://drupal.org/node/147828. This can be tricky because of dependencies between the tables (for example you can't share nodes without sharing authors because the sites would get different authors or no author for a node), so either follow some successful examples or understand everything and think it over carefully. When everything looks ok, you remove the old unused unshared tables from the database.

Or didn't I understand what the problem is?

nancydru’s picture

In my pre-planning for D6, is it possible to point to two different Drupal releases (I can't convert them all at the same time) and two different databases? I don't think my current host gives me access to the Apache .conf file, unless it is done through cPanel.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

cog.rusty’s picture

If I understand the question correctly, you could install Drupal6 somewhere and create new subdomains pointing to Drupal6 for each of your Drupal5 domains, like

site1.com (pointing to Drupal 5 installation)
d6.site1.com (pointing to Drupal 6 installation)

and use the second one for the upgrade of the first one, and when you are finished you just remove the subdomain and make the first domain point to Drupal6. There are ways to do all this without access to Apache.

The details depend on your host, for example whether your cpanel lets you point subdomains and add-on domains to whichever directory you want, or else you will have to use symlinks -- that is easy.

---------

On second thought... do you mean that your Drupal 5 sites have some tables shared and you have a problem upgrading the sites to Drupal 6 one by one? Yes, there seems to be a problem there... Errors when different sites try to repeat the upgrade of the same shared tables.

Probably each site's upgrade should be done on a separate copy of the initial tables to avoid that. Then you will keep only one copy of the shared tables (with any luck they will be identical).

But while this is done all sites with shared tables should be kept off line...

nancydru’s picture

I was thinking a D5 database and a separate D6 database. I would do the actual conversion on my PC and upload the database.

It might even work out that D5 resides on one host while D6 resides on the as-yet acquired new host.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

drupaceous’s picture

Thanks, your explanation cleared up some doubts I had about running the install script. I was thinking of sharing the user tables so that someone who registers at one hosted site is automatically registered at all the other hosted sites. However, I'm not sure how stable that solution is and how resistent it will be to future upgrades. Is there another way of doing the same thing without sharing database tables?

cog.rusty’s picture

Another methods for shared users could be a php script which runs periodically with cron and synchronizes user tables (not terribly convenient or failsafe, I think). Also check methods of external authentication such as the drupal module (in core) or the openid module (now contributed, but it will be in core in Drupal 6).

However sharing the users table happens to be one of the easiest problems for a multisite, because a users table does not depend on anything else except the user ID (uid). So, you don't have to share any other tables if you don't need to. A user can have different roles and different nodes in different sites, and all roles tables and all nodes tables will see the same user IDs, so no problem.

Mandatory shared: users table, sequences table (Drupal demands that one, for synchronization)

Optionally shared: sessions and authmap, which together with setting the same $cookie_domain in your settings.php could allow you achieve shared login.

Also the other suggestions in the example in the handbook page (profile_fields and profile_values if you use profiles, as well as roles and users_roles) could add convenience.