Creating Multiple Sites On a Local Computer

Last modified: November 7, 2009 - 16:07

Why

Drupal allows you to run multiple sites from a single Drupal code installation -- each with its own modules, content, theme, etc. For instance, you can run:

  • Multiple sites on your local computer
  • Multiple domains in a single hosting account
  • Multiple sub-domains
  • Multiple sub-directory sites

This page describes one fairly easy way to run multiple test sites on your local computer. For more general information, try the handbook on multiple-site installations.

Note: if you are creating multiple sites, it is desirable make a list of the desired sites before reading through these instructions completely. Some steps can be done in bulk to save time.

Why create extra sites? In addition to having several sites running already, you may have some ideas in the back of your head for other sites that you might put up in the future. So before you totally pooh-pooh the idea, give it a few minutes' thought. And you can always change your mind later; it just might be a bit messier then.

At the very least, you might create a "working" site other than your "root" site. This makes it easier to start all over again if you get totally out of control later on.

The Process

Introduction

This may look like a long process, but it's deceiving because it is spelled it out in detail. It is expanded and updated from the post "Running multiple sites on a local PC (localhost) from a single codebase, using Windows.". Instructions concerning Mandriva Linux 2009 Spring has been added here. For more details on the "official" stance on the sites directories, read Setup of /sites directory for multi-site.

If you want to get deeper into creating multiple sites either locally or on your server, you can search the forums at drupal.org with the term "multi-site"; there is also a group devoted to this subject at http://groups.drupal.org/multisite. Within the Handbooks, there is a good section: Multi-site installation and set-up.

Drupal needs a mail notification system (in fact, it can run without it, but you'll get errors messages, and won't receive the notifications by mail.) In Mandriva Linux 2009 Spring, you have to install one, for instance the Postfix package in Mandriva Linux control center → Software Management → Install & remove software.

The main idea is that you need a MySQL (or PostegreSQL but MySQL is recommended) database and a subdirectory of drupal/sites for each web site. Their names have to be identical (except for the default site, whose directory is drupal/sites/default and database may be called "drupal" or "Drupal52"). In the instructions below, this example name is "databasename". The database will contain your web site text, while the subdirectory will usually contain your web site pictures, specific modules and themes (the modules and themes common to multiple web sites are in drupal/sites/all). The Drupal package installation creates automatically a subdirectory drupal/sites/default and, in some systems, a database, for the default website. I suggest you don't use them, so that you'll always have a virgin site to copy or to compare to your sites. So the bulk loops below have to be performed as many times as you want to create sites.

Setting the databases

  • Open phpMyAdmin (using "other" in Web-Developer Controller. In MandrivaLinux 2009 Spring KDE: "Application launcher Menu" → Development → Databases → phpMyAdmin)
  • start bulk loop 1
    • On the left, select the Drupal51 database. This is the one that was created by the package installation. (In MandrivaLinux 2009 spring, the package installation doesn't create a database. If you don't have any Drupal database yet, create one called "drupal". When creating this database, use "utf8_bin" as "collation". "_ci" stands for "case insensitive". Then configuring your default web site through Drupal will configure and fill this database: in your web browser, go to http://localhost , and follow the instructions of the Installation guide for a single web site installation of Drupal: http://drupal.org/getting-started/6/install/run-script . Then come back to the following instructions.)
    • Click on "Operations"
    • Scroll down to "Copy Database to:"
    • Enter the new database name. It cannot contain spaces nor slashes. Some shared web hosting services restrict the names you can give to your databases. For instance, you might be forced to give them a name of the form yourdomainname_* . Since the database name has to be identical to your subdirectory name, it means that, on you hosting server, your drupal subdirectories names (except the default one) will be of that form. You don't mind now, because you're on your local computer. But the day you'll move your site to the hosting server, if your database names don't conform its requirements, you'll have to rename not only the databases, but all your pictures hypertext links inside your web pages. If you use a shared hosting service, it's better to check its rules now.
    • Verify that the radio buttons and boxes are clicked for:
      • Structure and data
      • CREATE DATABASE before copying
      • Add AUTO_INCREMENT value
      • Switch to copied database
    • Click on the Go button just below this area.
    • When the copy is complete, click on "SQL".
    • In the "Run SQL query/queries on database" box, enter:
      GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON databasename.* TO 'admin'@'localhost' IDENTIFIED BY 'superpw';
      FLUSH PRIVILEGES;
      • admin is what you call your administrative role (this is the "super-user" name); you can have a different administrator for each site.
      • superpw is the password for this user (you can use the same one for all databases to make it easy). Hint: you can create and save this in c:/www/drupal/grant.txt so you can copy and paste.
      • databasename is your new database's name.

    end bulk loop 1

  • Log out phpMyAdmin.

Setting the subdirectories

  • Go to the www/Drupal/sites directory (In Linux, it's probably /var/www/drupal/sites).
  • start bulk loop 2
    • Copy one of the site folders (e.g. drupal/sites/default) and name it as your database. It's possible you need to have super-user privilege to copy the directory. (In Linux, you can run in a console: su
      cd /var/www/drupal/site ; cp default databasename). Grant the web server and yourself write right to the directory drupal/sites/databasename/files/. You'll normally put your site pictures, typically in a drupal/sites/databasename/files/images/ directory. In MandrivaLinux, the web server user is called "apache"; you can run as root: chown -R apache /var/www/drupal/sites/databasename/files (don't forget to replace databasename by the name of your site subdirectory).
    • In your file manager (for instance Dolphin), open the directory drupal/sites/databasename/, grant yourself write permission on the file settings.php (Right-click on the file name and click on "properties".), then open it by double-clicking on it (Double-clicking will usually open it in a text editor as KWrite or Notepad.)
    • As explained in the file's comments, change the $db_url and $base_url lines. The $db_url line should be of the form
      $db_url = 'mysqli://username:password@localhost/databasename , containing the username, hostname and name of the database you just created. The $base_url will give the home page URL you want to use for the site, for instance http://databasename.
    • Close the file.
    • If you are going to have site-specific modules or themes, go ahead and create directories in this site to hold them (named "modules" and "themes").

    end bulk loop 2

Setting the hostnames

  • Navigate to the /www/Apache22/conf folder. (Step not needed in Mandriva Linux.)
  • Locate and open the "httpd.conf" file. Hint: always make a copy of things you're about to change, just in case it messes up. (Step not needed in Mandriva Linux.)
  • Some versions of Apache set index.html ahead of index.php, so don't have an index.html in your directory.

  • Find the line that says "# Virtual hosts." Remove the "#" from the next line. This allows you to make all your other changes in a separate, and less dangerous file. (Step not needed in Mandriva Linux.)
  • Save it. (Step not needed in Mandriva Linux.)
  • Navigate to the /www/Apache22/conf/extra folder. (In Mandriva Linux 2009 Spring, it's /etc/httpd/conf/vhosts.d)
  • Open the httpd-vhosts.conf file (In Mandriva Linux 2009 Spring, it's 00_default_vhosts.conf).
  • At the bottom of the existing list, comment out (adding the charcter "#" at the beginning of the lines) the examples.
  • start bulk loop 3
    • At the bottom of the existing list, enter:
      <VirtualHost *:80>
            DocumentRoot /www/drupal/
            ServerName databasename
      </VirtualHost>

      where databasename is your new database's name.
      In Linux (if Drupal files are in /var/www/), add instead:
      <VirtualHost *:80>
            DocumentRoot /var/www/drupal
            ServerName databasename
      </VirtualHost>

    end bulk loop 3

  • Close the file.
  • Navigate to the /windows/system32/drivers/etc folder. (In Mandriva Linux, skip this and go directly to the line beginning by "In Mandriva Linux" below.)
  • Open the Hosts file with an editor (Notepad for instance). Hint: these two steps can be done by using "other" in Web-Developer Controller.
  • start bulk loop 4
    • Add a line that says:
      127.0.0.1   databasename
      Where databasename is your new database's name.

    end bulk loop 4

  • Close the file.
  • In Mandriva Linux 2009 Spring, go to Mandriva Linux control center → Network and internet → Others → Host definitions. Choose the line "127.0.0.1", click on "Modify", and add the databases' names in the line "Host Aliases", separated by spaces. Then click on the 2 successive "OK" buttons.
  • Go back to Web-Developer Controller. (In Mandriva Linux: Mandriva Linux control center → System → "Manage system services by enabling or disabling them".)
  • Click on Apache2, in the top left. (In Mandriva Linux, it's "httpd".)
  • Click the Stop Service button.
  • Wait for it to change to "stopped."
  • Click the Start Service button
  • Wait for it to say "running."
  • In Mandriva Linux, click on the "OK" button.

Make your web sites

Go for it. You can now start the browser and enter http://databasename. Note that FireFox may need to be restarted to find the new domains. (Not needed in Linux.)

For more details on directories for multiple sites, see Setup of /sites directory for multi-site.

Just found a quicker way to do this

WebWeaver64 - March 5, 2007 - 00:25

All of this is using the Web Developer Server Suite http://www.devside.net/ using their database password and installed to c://www/

1. Database: phpMyAdmin > Create a database for each local site you want to create.
2. Drupal: sites/default > Paste a copy of this folder for each site you want to create > edit the settings.php for each site.
3. Apache: Add a virtual host for each site in Apache22/conf/extra/httpd-vhosts.conf
4. Windows: Inform windows that each site is hosted locally in c:/windows/system32/drivers/etc/hosts
5. Reboot, or stop and restart Apache2
6. Open your browser and type in the http://siteaddress/install.php and follow the prompts. Do this for each site.

Database: phpMyAdmin > Create a database for each local site you want to create.
Open phpMyAdmin and type a name for your database (playsite) in the Create new database textbox, click Create (I left Collation, in the dropdown box). You should get a message that says your database is created. Click Home icon and add the next one.

Drupal: sites/default > Paste a copy of this folder for each site you want to create > edit the settings.php for each site.
The 1st copy I create is a folder called: copy from I then add to this folder a files, modules, themes, & tmp folder so that as I paste from this all the folders I need are also created.
Copy and paste to the drupal/sites/ one folder for each site you created a database for from your default (or copy from) folder rename each folders what you want the site address to be (mysite.tst). I like to have .tst at the end so I know I'm not online, and I don't accidentally go to a real site. Before you start to copy make sure the settings.php isn't marked as read only (right-click>Properties>Read-only need to be unchecked).

Open settings.php (using a text editor) from the Copy From or default folder and edit the lines necessary.
$db_url = 'mysql://username:password@localhost/databasename';
($db_url = 'mysql://root:rootwdp@localhost/playsite';)
$base_url = 'http://siteaddress';
($base_url = 'http://mysite.tst';)
Save As to the folder for the site you addressed in the previous step. Do this for each site you want to create. Use the file you have open, just changing what you need to in the file and Saving As to each of the folders. You don't have to reopen the copy from or default file.

Apache: Add a virtual host for each site in Apache22/conf/extra/httpd-vhosts.conf
(if you haven't already done so you need to remove the # from front the the line in httpd.conf in Appache22/conf/ that says # Include conf/extra/httpd-vhosts.conf)
Open in a text editor the file Appache/conf/extra/httpd-vhost.conf, add to the bottom:

<VirtualHost *:80>
DocumentRoot /www/drupal/
ServerName siteaddress (ServerName mysite.tst)
</VirtualHost>

Windows: Inform Windows that your site is hosted locally in c:/windows/system32/drivers/etc/hosts
Open in a text editor, the file hosts in c:/windows/system32/drivers/etc/ (You can do this from within the Web-Developer Controller Other>Windows HOSTS File) at the end of the file if it isn't there already add: 127.0.0.1 localhost then add the same for each site you are creating to host locally:
127.0.0.1 siteaddress (127.0.0.1 mysite.tst)

Reboot, or stop and restart Apache2
You can stop Apache 2 from within Web-Developer Controller. Click on Apache2 and click on Stop Service, when the status reads Stopped click on Start Service when the status reads Running you're good to go.

Open your browser and type in the http://siteaddress/install.php
Open your browser and in the address bar type http://siteaddress/install.php (http://mysite.tst/install.php), this begins the installation and populates your database with the tables. You'll get a message saying Congratulations, Drupal has been successfully installed. click on the link your new site. And you'll see a Welcome screen exactly the same as when you install on a "real" server. Click on the link create the first account. in Step 1, and you will be creating your Administrator account in Drupal. You will receive a warning about the mail function because unless you set up your local host to send email it can't, so make sure to save your just created User Name and Password somewhere safe because without it being able to send an email I'm not sure you could get into the administration any other way.

Your done.

Linux Version

DanEvans - March 30, 2007 - 05:27

Here's an initial stab at doing this on a Linux installation. Tested using Ubuntu 6.10, Apache 2, Drupal 5.1.
NOTE: Further digging suggests that http://drupal.org/node/53705 has a better (and probably "approved") approach. Read that carefully.

Assumptions:
1.Apache root is /var/www
2.Drupal initially installed at /var/www/drupal
3.Drupal database (in MySQL) is “drupal”

To create new site on same machine:
1.Create new copy of Drupal DB in MySQL (e.g., name it 'drupal2') by copying data & structure from the DB drupal
2.In /var/www, copy the drupal/ directory to new directory-- use same name as new DB (e.g., drupal2) (thus will have have /var/www/drupal and /var/www/drupal2)
3.In /var/www/drupal2/sites/default, edit the 'settings.php' to use the new DB name (drupal2)

That's it. Now you can navigate to http://server/drupal to access the original Drupal site and to http://server/drupal2 to access the new site.

Re: multisite needs multiple users

atulrd - July 10, 2007 - 19:22

Nancy,
I would like to say that the grants above should be executed for each databases.
i.e. If I create 3 database smdev,smtest and smprod
I should have 3 users as below
# Development SMDEV
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON SMDEV.* TO 'devadmin'@'localhost' IDENTIFIED BY 'admindev';
FLUSH PRIVILEGES;
# Test SMTEST
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON SMTEST.* TO 'testadmin'@'localhost' IDENTIFIED BY 'admintest';
FLUSH PRIVILEGES;
# Production SMPROD
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON SMPROD.* TO 'prodadmin'@'localhost' IDENTIFIED BY 'adminprod';
FLUSH PRIVILEGES;

And then - I refer each in settings.php

It took me couple of days to figure this out.
Your document says "admin is what I call my administrative role (this is the "super-user" name);

superpw is the password for this user (I tend to use the same one for all my databases to make it easy)."

But - I like your document - it got me started.

Regards
atul deshpande
atulrd@hotmail.com

"Loop"

NancyDru - July 10, 2007 - 21:34

"start bulk loop 1" and "end bulk loop 1" means to do each of those steps for each site/database.

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

WAMP Configuration

cbarnett - August 9, 2007 - 12:24

I found a fairly odd, and dare I say erroneous, description of how to set up Apache, name-based virtual hosts in the devside.net forums. I added a reply there which simplifies it... I hope. The issue is the way 'webapps' are set up. It's a bit non-obvious, but it's very flexible, so I would recommend working with it, rather than stomping on it. Here's the link: http://forums.devside.net/index.php?topic=1539.0

BTW - By 'stomping on it' I mean installing Drupal in the main document root of your WAMP setup. This should work as well, but working with the WAMP setup gives you more choices.

Please note that I make no comment regarding the MySQL users and their passwords, or anything else. This is just about getting name-based virtual hosts working under the WAMP 'stack'. You have to do this before setting up virtual sites in Drupal - which is trivial, by the way, once you get virtual hosts working under Apache. If you're using the WAMP setup to run a Windows-based, publicly accessible set of virtual sites: 1. you're nuts, and 2. you'd better read up on security ;-P

"Open phpMyAdmin"

tchoakim - August 9, 2007 - 13:15

OK I really got stuck at this point. Every time I tried to go to MyPHPAdmin it would ask for a user and password. No clue as to what this should be as it wasn't involved in the install. Installed the Web-Developer Suite 4 times, twice on my desktop and and twice on my laptop. After messing around with all kinds of ini and config and php for 20+ hours I discovered that all I really had to do was use "root" as my user name and whatever password I had entered after performing the following directions from the Web-Developer manual.

Change the default MySQL user 'root' password

Open the command prompt and change to the C:\www\mysql5\bin directory...

mysqladmin -u root -prootwdp password new-password-here

Note that 'password' is a literal string -- do not substitute in anything.
Note that there is no space between '-p' and 'rootwdp'.

The key is that "root" is your user! Put that in with your password and you are in.

Note: This first sign in is when you want to create your "superuser" with all of the privileges.

Passionate about community, business, and the internet.

Default root password

kmull - November 9, 2007 - 03:53

tchoakim-

I had similar difficulties and wasted more time than I am comfortable admitting. To spare others from the misery that I put myself through, I would like to add to your comments.

Since it took me a little time to find it, here's the manual for Web-Developer: http://www.devside.net/download/wd-guide/

In addition, though the Security Measures section of the manual rightfully recommends changing the root password as soon as possible, it is not absolutely necessary. The default username and passsword to begin using phpMyAdmin as indicated in the manual are as follows:

Username: root
Password: rootwdp

A couple of "Gotchas"

aireworth - August 27, 2007 - 23:44

Firstly, thanks very much for the information here Nancy - it came in very handy. This page and the one on the "sites directory from multi site" were the most helpful (and eventually all I needed) when setting up Drupal for multisites.
However, I came across 2 things which greatly slowed me down - firstly, don't use upper case letters in the "sites" folder for the new site folder - e.g don't use "www.EXAMPLE.com" as a folder name. It seems Drupal doesn't equate www.EXAMPLE.com to www.example.com, and by the time the site name is passed to Drupal, all the upper case letters have been converted to lower case - by Apache or the browser or somewhere. I was trying to get multisite to work for (something like) AWVP.co.uk and had a folder in /sites/ called /AWVP.co.uk/, but I kept getting the default drupal site. Changing the folder name to awvp.co.uk made everything work properly.

Secondly, in the vhosts file, Apache uses the *first* virtual host entry as the default. So if it can't match anything else in the file it uses these settings. I had a first entry which said
"DocumentRoot /opt/lampp/drupal/" and as Drupal was not finding my sites I kept getting a "file not found" from the default install, even when trying to access localhost (which should have given me the default page from /lampp/). I got round this by adding a virtualhost entry which just said "DocumentRoot /opt/lampp/" at the top of the list.

Finally, although there are many ways to skin this particular cat, I found setting up the extra databases to be easiest by going to the phpmyadin home page, clicking on "privileges" and then on create new user. Give the user the new site name, and click on "Create Database with same name" granting full privileges. Then all you have to do is to copy the data and structure from the original Drupal database into the newly created one. It also means each database has its own user and password, although I don't know if there are any advantages or disadvantages to this.
Thanks again, Colin.

Good tips

NancyDru - August 27, 2007 - 23:49

I've also recently had problems with using upper case in the "files" directory. So I guess the operative word here is "DON'T." Keep everything lower case and you'll have fewer problems, even if you don't like the look.

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

Case sensitivity

sleepingplanet.com - September 9, 2007 - 10:02

Hi,
just FYI, its apache that gets its knickers in a twist about the case.
So even if you aren't using drupal (i keep a couple of folders outside my drupal site for use by anon ftp etc.) You have to get the case right.
Keeping it all lower case is definitely a good idea. Very frustrating if you've spent a good few years programming and calling variables things like MyValue and HelloWorld.

Great handbook btw!

Vista Issues

mchenosky - November 13, 2007 - 04:13

I'm trying to set up multisite on windows Vista. When I followed exactly the "start bulk loop 3" step, I couldn't get it working. Then I searched on the web and figured to replace:

DocumentRoot "C:/www/webapps/drupal"
ServerName databasename

by:

DocumentRoot "C:/www/webapps/drupal"
ServerName databasename

Options All
AllowOverride All
order allow,deny
allow from all
AddType text/html .php .phps
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .phps

It seemed able to display the first page "Welcome to your new Drupal website!". But when I clicked any link (e.g. "Create new account"), I got an "Internet Server Error".
Any help will be welcome. I'll post any update if I get the "Internet Server Error" resolved.

Re: Vista Issues

mchenosky - November 14, 2007 - 06:19

The issue is in part b: basic configuration, I have enabled clean url. So for multi site setup, please skip that step. For detail, please read: http://drupal.org/node/186537. It solves my problem.

Poor Mans Version

webthingee - February 22, 2008 - 19:10

I had some success for my own needs and shared them at...

http://drupal.org/node/225455

Not for Newbies

mikeque - March 13, 2008 - 19:43

While this is important to mention to newbies, I think it is a little complex to dive into at the beginning of learning Drupal.

You have no idea what this put me through

jamescarvin - April 18, 2008 - 04:16

There are a couple of things peculiar to web developer that people will have to know. Since I spent the past thirty days installing and resinstalling it, and then finally getting these instructions right, only to have problems with VirtualHost and DirectoryBlock info not being set right, I wouldn't recommend this for a beginner - like I was.

But just in case you are new and you venture into setting up drupal through web developer, then please read through the thread I sarted on the web developer community site at http://forums.devside.net/index.php?topic=1688.0

I came into a problem that I know that some others have been having. And I finally solved it. Web Developer points php to vhosts rather than to www/webapps/drupal. This causes you to not get permission to access files or to get an html print out of your index.php file when you go to http://YOURSITE

Now, because I started trouble shooting and getting on forums and IRC at #drupal-support I got all sorts of opinions about how to fix things, which is what led me to put VirtualHost and Directory blocks into my httpd.conf file. People you talk to won't know right away that there is an include file pointing to vhosts unless they see your whole file, so if you take their advice you'll wind up with bunches of bad stuff.

Last comment - the Getting Started thread here talks about www/drupal - but web developer obviously puts it into www/webapps/drupal. Make sure you don't follow the instructions to the letter.

James

I was running into the same

MooMaster - April 18, 2008 - 16:33

I was running into the same 403 problem. I realized that, like much Open Source documentation, this is incomplete. Chances are that you got the 403 error because you are missing the proper permissions in your virtual host for directory access. It *really* should be the following:

# SexyTime virtual server used to test multi-site drupal setup
#
<VirtualHost *:8080>
        ServerName sexytime
  ServerAlias *.sexytime.*
  DocumentRoot "D:\www\webapps\drupal\sites\sexytime"
  <Directory "D:\www\webapps\drupal\sites\sexytime">
    Options Indexes FollowSymLinks
      Order allow,deny
Allow from all
  </Directory>
</VirtualHost>

Notice the Directory XML tag (Apache Directive). Without it, you are likely defaulting to root directory permissions, which deny all. Also, make sure your DocumentRoot is pointing to a valid path. Check your error logs in Apache/logs

Where xx is >= 2.2

Hope this helps
Moo Moo Moo

This worked for me

sjmills93 - November 16, 2009 - 20:36

Thanks MooMaster

I can finally actually begin to learn Drupal, now that I can browse to my site!

Other documentation had led me to have only the following :

DocumentRoot C:/xampp/htdocs/drupal/sites/mysitenamehere
ServerName mysitenamehere

By adding the Directory portion to this code within the xampp/apache/conf/extra/httpd-vhosts.conf this fixed the problem!

Thanks

OF COURSE: I had to remember to STOP and START my Apache server to effect these changes

...easier to setup a local host with wamp server

nirvanajyothi - June 17, 2008 - 05:59

Its always better to have a facility to fearlessly test and experiment easily and faster with the new drupal and its features on your own computer and to try the new modules which you like to add before you add them on a live production site.For this you will need to setup drupal in a localhost .Its easy to setup one by installing wamp .You can download it from< http://www.en.wampserver.com/ >and watch a screencast on how to install it at < http://www.lullabot.com/node/275/play >

How To's

kkobashi - March 13, 2009 - 19:01

Seeing so many people are struggling setting up Drupal I wrote a few tutorials on how to do this.

How to setup a Drupal multisite on Windows

How to setup a WAMP environment

Hopefully this helps someone.

Problems & Solutions..multisite setup success.

romanse - May 3, 2009 - 22:33

Ok, great. You got your original install to work seemlessly. Or..like me, you had to research why it was that you are getting very slow paging in the browser and you get bad news at site1.com/admin/reports/status. It seems that http_request_fails . If you get this also the following fix miraculously allowed lightening fast paging and removed the red status flag:

Ok, now, great! Let's mutiply our drupal sites. Copy the default folder in the sites directory. You can delete default.settings.php and you must now edit setting.php for new site1. Similar hence confusing names occur in the help literature. ie. site1 and site1.com. In this case, it is appropriate to actually name each new site folder with the .com, .ca, etc. When setup is done you then type in a real world address in you browser and see how it nicely goes right to your own drupal testing site. Once again, if your first new test site url is to be site1.com then you name the new folder "site1.com". It will at c:\wamp\www\drupal\sites\site1.com or similar depending on your own installation.

You will have installed your initial drupal site at drupal\sites\default. In setting.php you have subbed in your own choices at this line:

  • * $db_url = 'mysqli://username:password@localhost/databasename';

To organize for each new site you want you must edit the setting.php. You may write php code lines similar to the following:

  • $db= "site1_db";   //SQL database name
    $un= "site1_user";  //SQL username
    $pw= "pass1";   //SQL password
  • * $db_url = 'mysqli://$un:$pw@localhost/$db';

If your case is the same as mine you do not need to work with the $base_url in the settings.php.

Now on to the database and user set ups at phpmyadmin to set up unique user/password pairs for each site. Remember each site will correspond to one database. If each site/db has a unique user/pw set then things are kept modular and more secure. Duties for each site can then be handed down to others if needed in future. Copy the original drupal database for the new site and give it the new database name. As per the nicely detailed instructions in this drupal cookbook page I had the 3 radio buttons selected. I got an error regarding duplicate primary keys. By also selecting the "Add AUTO_INCREMENT value" the whole database copied.

Next is to go to phpadmin home and to Privileges to add user/password entries for each new site.

  • Open phpmyadmin and click Privileges
  • below existing users click "Add a new User"
  • in "Login Info" pass in the user=site1_user, host=localhost, and password=pass1

Leave the "Database for.." set to none and no Global privileges. Click Go. Great. Now click Privileges in the top tabs again to get to the user list. Click to edit the new user privileges. Don't check anything in the top checklist. At "Database-specific.." drop down the menu and select the database=$db. Page should switch to list for that db. If not click Go. At this next page the list is just for $db. Check list for these 8 items: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER. Click go. Done.

Next, the mighty Apache...here I could not get things right until following the good example by drupal member kkobashi. This is the link to his helper: kk's help. The cookbook guidance here was essential and easy to follow but I had to follow kk for the code to use at Appache/conf/extra/httpd-vhost.conf and at C:\Windows\System32\drivers\etc\hosts

Drupal is brand new for me. It is exciting. The multisites all are working great thanks to lots of helpful well commented drupal files for installing and default settings, etc. No way to get it understood and working without this cookbook page and it's creator, and other drupal members such as kkobashi.

the Portal

Moving

Fiable.biz - August 30, 2009 - 06:45

The next question is how to move such a web site to an internet server...

http://Fiable.biz Web site creation.

 
 

Drupal is a registered trademark of Dries Buytaert.