3

I'm posting here after my post on Webmasters was flagged to be moved here.

First of all, I'm new to Drupal and the work I have to do is some kind of too hard.
My old colleague (webmaster) had a server with a multisite Drupal 6 installation.
Sites and their dirs were (e.g.)

Sites              Site directory
b.a.mycompany.com  /drupal_install_dir/sites/b.a.mycompany.com
c.a.mycompany.com  /drupal_install_dir/sites/c.a.mycompany.com
d.a.mycompany.com  /drupal_install_dir/sites/d.a.mycompany.com

Unluckily my colleague moved and server hdd aren't in my hands: all I have is a backup of /drupal_install_dir and three sql dumps (one for each site).
I had to restore three sites, but changing them as

z.mycompany.com/b
z.mycompany.com/c
z.mycompany.com/d

Beeing a sysadmin, I

  1. Extracted tar.gz backup file under wwwroot (let's call full path to extracted directory /new_install_dir)
  2. Restored three databases
  3. Created mysql users and give them correct GRANTS on databases

Then (trying to restore at least first site) I changed /new_install_dir/sites/settings.php putting correct database connection data and new basepath.
But there is no way I can see my new site, simply it doesn't work.

Watching /var/log/apache2/error.log I saw Drupal searching for main drupal database; so I created that db too setting user and grants, but dump file is empty. Well, now I can run something like install.php or update.php, but my site is not shown.

Is there something I can do?
Do I have to walk another way? Consider I searched the web, but I'm not able to find a guide that can help me for my problem.

Ah, I forgot: before producing the backup, my colleague set site in maintenance mode.
When I try to run z.mycompany.com/?q=user (trying to login) nothing happens.

I'm really stuck...

UPDATE
Those are my tries (unsuccesful)

  • Cleared anything and started from the beginning
  • Extracted Drupal6 installation in drupal6 directory
  • Executed (in wwwroot) ln -s drupal6 b: with this every request for z.mycompany.com/b is managed by Drupal6
  • Created sites/z.mycompany.com.b, restored old backup coming from old server here, edited settings.php with $baseurl=https://z.mycompany.com/b and correct database params

Now I tried two things:

  1. Restore db from backup (without modifying entries in it)
  2. Restore db from an edited version in which I changed various entries pointing to old site

Both don't work: either I get a Drupal "Page not found" or a partial site.
I also tried to look at sites.php, but I don't think this can solve my problem: my server, my ip, everything is changed!! IP for b.a.mycompany.com is different from the one for z.mycompany.com adn I cannot have a dns redirection.

MY SOLUTION:
I finally managed to make my new site live.
In addition to what I did in my UPDATE section, I had to:

  1. Edit my database dump to change every reference to my old site.
    Note that I had a lot of different kind of references (base urls, sites dir, etc.), so Notepad++ was my friend.
    Another note: some of the entries are serialized (with php serialize()), so you have to manage arrays end edit string lengths too.
    Remember that you don't need to restore cache... and watchdog tables
  2. Restore my site dropping sites/all directory (with that on, I wasn't able to start Drupal correctly)
  3. Restore files and dirs permission (e.g. chown -R www-data:root sites/z.mycompany.com.b)
  4. Log in as admin and perform some maintenance and run cron.
  5. Restore sites/all directory and restore files permission chown -R www-data:root sites/all
  6. Modules and themes in database were automatically turned off: turn them on inside administation panel

I had to tell you that /var/log/apache2/error.log was really needful to discover something I missed or did wrong.

  • 2
    As side note, when a question has been flagged to be migrated, wait a decision has been taken, before to re-ask the question on the site which would receive the migrated question. Normally moderators for the first site ask to the moderators of the receiving site if the question is appropriate for their site. If a question is not migrated, it can be the question is not acceptable in the receiving site; if you ask the question on the receiving site, you could be asking a question that is then closed. – kiamlaluno Aug 31 '12 at 22:18
  • @kiamlaluno: I beg your pardon, really! – Marco Sep 1 '12 at 12:19
  • Also if you want to reset all your drupal file permissions in one go, try this series of commands: \chmod -R 755 *; find * -type f | xargs chmod 644; – Rider_X Sep 3 '12 at 18:32
3

You may have a typo but the path in your new installation /new_install_dir/sites/settings.php is incorrect for either a multi-site or single-site setup. From your description you old setup was a multi-site setup.

Background

Multi-sites

Multi-sites use one code base to serve up multiple sites, which are contained in the sites folder. All URLS resolve to the same root drupal folder on your server and drupal sorts out which database and files are needed.

If you were just recreating your previous multi-site se up the paths to the settings file would look like:

/new_install_dir/sites/b.z.mycompany.com/settings.php
/new_install_dir/sites/c.z.mycompany.com/settings.php
/new_install_dir/sites/d.z.mycompany.com/settings.php

Single Site setup

However, from your brief description it looks like you want to move away from a multisite setup to three single site setups, where each of the three URL's resolve to a different server directory that contains an independent drupal setup. In this case your paths will look like:

/new_install_dir_a/sites/default/settings.php
/new_install_dir_b/sites/default/settings.php
/new_install_dir_c/sites/default/settings.php

Problems with going from multi-site to single site setups

The main problem is that you technically can't switch between. This is because a number of database tables (for example: system and files) include references to "sites/www.mydomain.com." If you change paths to modules, themes and files may all have changed depending on the setup, and Drupal can fail during the bootstrap.

Highly Dangerous Fix

That said, I have changed the URL of mutli-sites without server redirects by directly editing the database. I first turn off all caching, and disabled all the modules and theme before dumping the database. I then edited the database (dangerous) and changed the paths. This is somewhat problematic as variable lengths associated with the path will also have changed and should be properly updated. At the time I did it with a text editor and some impressive regular expression searches, but you should be able to do it with MySQL commands?

I then moved the files to the new URL, imported the edited database and appropriately modified the settings.php file. I then somehow got drupal to bootstrap. It appeared partially broken, but still allowed me to log in. I then immediately cleared the cache and got Drupal to rebuild the theme, module registries. After that everything seemed to work fine. I also remember doing a number of other crazy things in the middle of the night that I can't remember and I didn't feel like trying to recreate situation to narrow down all the steps.

  • This summarizes just about everything, but omits one key thing. One you go multisite, you don't need to do the dangerous step. Just follow the directions to create a sites.php file. This will allow you to map you new URLs to the existing paths that Drupal has. This is somewhat analogous to the way ServerAlias works in Apache. – mpdonadio Sep 2 '12 at 0:54
  • Thanks for your help; I passed last day trying to reconfigure my new multi-site server to let old site works. Naturally without any success. I'll try with your and @MPD suggestions and let you know :) – Marco Sep 2 '12 at 5:15
  • Take a look at my edited post if you can. Thanks :) – Marco Sep 3 '12 at 6:08
  • @MPD: Take a look at my edited post if you can. Thanks :) – Marco Sep 3 '12 at 6:09
  • Thanks, your post helped me to find good docs where to start in. Finally I managed to restore on of my sites doing manual work as you did: it was not so simple nor funny, but it worked. Now I start with other sites. I edited my question adding (part of) steps I did, hopping someone in need can use it. – Marco Sep 3 '12 at 12:49
0

As the multisite documentation states:

Once a site is in production in a particular subdirectory under the sites directory, the subdirectory should not be renamed, even if the Web site URL changes.

Try restoring your site without renaming anything (If you can't change any DNS settings for your old domains, you can override them in your hosts file temporarily) and if that works then you can follow the instructions for domain name changes.

  • Or just add a sym link like z.company.com -> b.a.company.com – GoodSp33d Sep 1 '12 at 5:57
  • @kantu, symlinks aren't needed and not all Apache configs support them. The best way is to use a sites.php file. – mpdonadio Sep 2 '12 at 0:55
  • @MPD - My edit the database approach was for D5 and D6 sites. Many of us are still stuck back a generation or so. The sites.php is a nice approach if you are using D7, thanks for mentioning it. – Rider_X Sep 3 '12 at 22:52

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.