Hello,
I know you guys probably and completly understand this. But would someone mind giving me an actual example of why or when this would be applied?

And I'm sorry, but I also need to ask another question (probably silly to some of you), is a sub-domain considered a 'multi-site". and if so, would a person be able to use different themes as well while tapping inot the same tables? I'm asking because the current project lays out better as a sub-domain, though I've never done one yet and was trying not to.

Comments

kbahey’s picture

http://drupal.org/node/20650

Also, the INSTALL.txt from Drupal 4.6 explains this pretty well.

Basically, in the sites directory create as many subdirectories with the domain names you want. In each, put a settings.php file.

The settings.php file will have the domain name in the $base_url.

A subdomain can be a multisite as well.

If you point the various settings.php to different database, or the same database with different $db_prefix, then the sites are completely independant.

If you point them to the same database, then they are just aliases (same content, same users, ...etc.)

Do not try to share some tables across various Drupal instances. This will complicate things for newbies. Either share it all or don't share anything.

Oh, and each site can have its own theme(s), whether shared (in ./themes directory), or site specific (in sites/domain.com/themes). The same is true for modules.

If you have further questions after you read that, then let me know.
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

green monkey’s picture

thank you, i was holding off downloading till I knew i would need 4.6, curretnly using 4.52

thank you, i have a better grasp now

kbahey’s picture

Basic multisite functionality is there in 4.5. I think it was there since some other 4.x release too. I have been using it for about 16 months now.

It is just a bit better for 4.6, with the ability to have site specific themes and modules.

Since 4.6 is out, there is no point in trying with 4.5. The file names have changed, and better not confuse oneself.
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

green monkey’s picture

Thanks Khalid,
I was thinking the same thing and I also read your upgrading post.

The site is only about a week of construction old. I just did an FTP backup of site and about to do MySQL. I'm going to pull it down and bring it back up as 4.6.

There is one more small bit of info I don't know. I went to the Download area and saw the patches that have been made to 4.6 (fixed).

If I download today, will those pathces be in the version I download today or will they be in something like 4.61?

Thanks

kbahey’s picture

I am not sure what you mean by "I went to the download area and saw the patches".

4.6 is currently stable, and so far, there are no patches or point releases.

If your site is just one week, go ahead and re-do it on 4.6 while it is fresh from the oven.
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

green monkey’s picture

sorry to confuse you, I don't always know the proper phrases or termonlogy to use "yet" .. but we're learning

http://drupal.org/project/issues/drupal?categories=bug

this is the page I talking about,

kbahey’s picture

Oh, these!

Let me explain a bit:

Anyone can find bugs, and open an issue for it. It is encouraged so that problems have a chance to get fixed. If it is never reported, then it will never get fixed.

Some of these are not bugs, but feature requests as well.

Some more experienced users of Drupal go a bit further, and not only find a problem, or request a feature, they submit a change that would implement the feature or fix the problem.

Anyone can submit a patch. For example, if you want Drupal to peel potatoes, you can submit a patch for that. This does not mean that this patch will be accepted, nor there is any guarantee that it would make it to a future release.

Patches are often discussed, voted on, modified, shredded, torn to pieces, refused, ignored, and burned on the stake.

So, do not worry too much about those patches. Go and use 4.6 and be happy.

To be 100% sure, scan the issues that are marked critical and see if they affect you. You may not even be using the feature that has the bug in it (e.g. distributed authentication, aggregator, ...etc.), so you may never see the bugs at all.

Enjoy...
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

green monkey’s picture

once again, many thank for clearing that up.

There is so much to learn.

I just learned a hard lesson about templates - be careful which one you use - they don't always make the upgrade transition ... and just when I had it tweaked.

Thats ok, I learned alot about CSS, so it will be faster time time around.

PierreFWalter’s picture

I do not see any sense in the INSTALL text regarding multi-site setup. The only way that a sub-site works is to leave the sites/default/settings.php file in the sub-site's directory tree because removing it disables all.

But that means that the sub-site cannot be 'remote controlled' by the main site, and this is what we want. The only useful thing to do with multi-hosting is to share the modules and themes with all 'downline' users.

Let me explain. I have seven additional modules to install for all my Drupal sites, so that they function nicely, and I want to give this functionality to all my users.

The main site is at blogpower.info, one sub-site is at nelson.blogpower.info. I do not want to have all the work with installing all these seven additional modules for all my new users. This is lots of work because it's not just uploading the modules, but setting the permissions each time and also configuring the new modules.

So what I want is to share *all the modules* that I have installed at blogpower.info main site with all my 'downline' users.

And this is exactly where this Drupal multi-site functionality would be useful, but it does not work.

It works only in the following way.

I set a directory 'nelson.blogpower.info' within the 'sites' directory of the main site. Then, I create a sub-directory 'modules' within this directory, then I upload one of my new modules, say the dba module, here. Result: the dba module will show up and function for the nelson.blogpower.info sub-site.

But this is of no use for me. I need to do the same work as when I upload the module directly in /blogpower/nelson/modules/.

So, where is the real functionality of this feature? I have sent you an email two days ago, Mr. Khalid, with the same question and you did not reply to it.
Pierre F. Walter
(Coach)

PierreFWalter’s picture

More precisely put (maybe I do not express myself very well), I wish to share *only* the modules, *not* the database because each user wants to have his or her own site, blogs, and privacy. Also regarding the themes, I've made one custom theme that is quickly installed for each user's site. The main work is with the modules. There are several of the modules I wish to install that require to run its own sql file before it can be enabled, such as the Google Sitemap (gsitemap) or the Bookreview module. And here a sharing across 'downline' Drupal sites would be highly desired.

And to put my question again precisely: is this really possible with Drupal's multi-host functionality, or am I mistaken about this issue. Does this perhaps instead require to modify the settings.php file(s)???

I would appreciate advice on this tricky issue:)

Pierre F. Walter
(Coach)

cghobbs’s picture

I know for 4.7 the way to do it is pretty simple.

Let's say your site is installed in www.example.com

place any themes or modules you want to be shared across sites into

www.example.com/modules (*note: good practice is to put additional modules into a sub folder of modules called "contrib" - makes for easier upgrades).
www.example.com/themes

If you have any site specific modules then you put those into
www.example.com/sites/www.example2.com/modules/
(or the same goes for themes)
www.example.com/sites/www.example2.com/themes/

then to point each site to a different database you do so in their specific settings.php file.

liza’s picture

Thanks for the effort but I don't think your answer really tackled the requirements. Let's bump this again to the top : Pierre Walter and i --and i am assuming others as well-- want to create multi-site installations whereas :

(1) each domain has it's own database BUT

(2) all domains share the same MODULES folder

To which I would personally like to add the following :

(3) all users may use the same login w/o having to enable the drupal module AND
(4) w/o having to upgrade to 4.7

unfortunately there are more than a few modules I have to run that are still under 4.6. Upgrading to 4.7 is out of the question.

lekei’s picture

I wrote an installer that handles all of those issues and works with multiple subdomains and domains, using a common database and prefixed tables, partially shared tables, or seperate, prefixed databases.

It works with 4.7 and 4.6 and uses a single settings.php for all sites.

To install a new site, just set-up your web server to accept that domain as an alias and access the domain with a web browser. A wizard picks it up and walks you through creating the database for the site.

If the modules have .install files it uses them, otherwise it intellegently selects the .mysql or .pgsql (and handles cases where there are .mysql41 etc files.) and parses them and adjusts for the appropriate database settings.

The only thing it doesn't handle are sub-directory installations (/site1 /site2 etc).

It also sets some defaults for sites, calculates the default time zone, recommends a default site name, and allows you to pre-load the defaults based on a sql dump from a reference site.

Additionally, it builds a master cron task that runs the cron tasks of all sites.

You can see the full readme at:
http://www.lekei.ca/dl/files/drupfile2/files/readme.txt

or download the installer from:
http://www.lekei.ca/dl/files/drupfile2/files/autoinstall.zip

or read more at http://drupal.org/node/33581

liza’s picture

Now, if I use this, what's the issue with the LGPL?
Maybe this question ought to go into a new forum topic?

lekei’s picture

LGPL is compatible with GPL, except that you are not forced to make all of YOUR work GPL. I have an ethical issue with creating new GPL work. Of course you choose to restrict others freedoms by using this code as a basis for your own code and licence that derivative work as GPL.

Under LGPL, you are free to incorporate this into Drupal (under GPL) and and force others to give up their Freedom of association. Members of the Church of Stallman (Gnights of the GNU) are not allowed to buy code under any circumstances, they must write it, find someone willing to share it, or steal it. They are not permitted to consort with EULAtarians.

LGPL lets you keep your religion to yourself.

If you don't feel comfortable unless you are forced to give up your rights then email me and I will send you a GPL licenced copy. In fact, if you realy need to feel controled, I can send you one with a licence which prohibits you from having any EULA licenced software on the same computer. Of course that can't be run under Windows, or most Linux computers (the BIOS is licenced under an EULA). I think that if you can get Linix to run on an Intel Mac it may be ok.

Oh don't get me started (that was really close).

PS. The above message was a form of prose known as satire. Yes it is legal to use LGPL code with Drupal (do you see the fear and confusion that GPL creates?). All the Gnights can do is ban ME from officially contributing to Drupal.

jsa’s picture

Members of the Church of Stallman (Gnights of the GNU) are not allowed to buy code under any circumstances, they must write it, find someone willing to share it, or steal it.

Please, there's a difference between satire and bald-faced lying.

See http://www.gnu.org/philosophy/selling.html for the FSF's position on charging for software.

chueewowee’s picture

I'm up for this one, I'll check it out, Maestro. Does it prefix the tables?

lekei’s picture

Yes it prefixes the tables. For modules without installers and Drupal itself, it reads the sql files and adjusts them appropriately. It works with 4.6 and 4.7.

If you have a default installation profile you want to use, you can save the SQL from a default site and it will import it into the new site. Including modules that have multiple SQL files for different database versions (eg. Drupal itself). If there are multiple database versions (eg. for MySQL 4.1.x and 4.2+) it figures out which one to use for your server).

It also includes an automatic settings.php file which means you don't need to create new settings.php files for each site. One file fits all. Simply access the new domain and the wizard takes care of the rest.

The settings.php file does not require the install wizard. It has the following features:

A few options and settings, everything else is calculated automatically.

Automatically builds database prefixes based on the domain and host. By default it merges tlds together (eg. site.com site.ca site.org) but that can be configured, as can the list of tlds that are ignored. You can choose to have each site use a different database or prefixes in a common database.

It has the option of making any site beginning with dev. (eg dev.yoursite.com) use an alternate database server or the same server as other sites.

It has a debug mode, so you can diagnose start-up problems.

It (optionally) automatically builds the temp and file paths so they are unique per site. (You will, of course, need to manually go in and adjust permissions to those paths).

It adds a safe mode start-up so you can launch your site with minimum configuration (no clean urls, etc.) in case you lock yourself out.

It automatically runs the setup wizard (which requires you to enter the db password) if the database has not been set-up for a new domain or host. There is an option to disable this if you do not use the wizard.

And it has actual documentation. Read the readme file, it is not your usuall "this is a redme file... for more information trace through the code".

walterbyrd’s picture

Most web hosters require a set prefix on the database name, and users are usually not allowed to alter that prefix.

venkat-rk’s picture

Thanks, your reply does make it more clear than the install.txt I read this morning. Would you mind explaining the following a bit more? They sound the same to me- that is, it sounds like pointing to the same database is like sharing tables across drupal instances:

If you point them to the same database, then they are just aliases (same content, same users, ...etc.)

Do not try to share some tables across various Drupal instances.

kbahey’s picture

If you point them to the same database, then they are just aliases (same content, same users, ...etc.)

Say you have a site called host1.example.com. You have a single database (called host1 for example) with drupal tables in them. Let us say they have no db_prefix for the sake of simplicity.

In the sites/host1.example.com/settings.php it points to the host1 database, and has http://host1.example.com.

Now, if you have another file called sites/host2.example.com/settings.php which is an exact copy (or a symbolic link) of the first config file, then people who get to host2.example.com will get the exact same content that is on host1.

If sites/host2.example.com/settings.php has a different $base_url (say "http://host2.example.com", then the content will still be the same. The users, the nodes, and everything is still the same, but the domain will be accessible using the other URL. This is useful for someone who wants the site to be accessible for http://www.example.com and just http://example.com

This is how an alias works, different host names, same content. The easiest way to do so is to create a symbolic link for the directories, so sites/example.com is linked to sites/www.example.com, and everything under it will be the same. This assumes you are using Linux or other Unix flavor (Mac OS X included) for hosting. Not sure if Windows allows that via shortcuts or something else.

You could also have the same content with different $base_url settings. So the settings.php file will be the same for everything except that host1.example.com in one and host2.example.com in the other. The content will still be the same, but it can be confusing to users, and perhaps search engines?

All the above applies to 4.6. The same functionality is present in 4.5 by the way, but the files are in includes/host1.example.com.php and includes/host2.example.com.php instead.

Do not try to share some tables across various Drupal instances.

In the handbook, there is a section on sharing tables across Drupal instances, such as the user table. So domains would share the user list. This is a complicated setup and can cause confusion to the users (they signup to site A, but find that their info is also on site B), and a support burden for the site admin (what about sequences, will it break any modules, ...etc.).

I personally do not like it, but perhaps someone else who used it finds it useful. Let us hear from anyone who did this.

Is it any clearer now?
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

venkat-rk’s picture

Wonderfully clear. Thanks for taking time to explain in detail. Much appreciated. I doubt if I could have got so much information from the handbook.

One last question: when using aliases, do both domains need to be on the same host? Or can they be on:

a.) different servers with same hosts?
b.) different servers with different hosting companies?

Sorry if these questions sound dumb.

kbahey’s picture

Before I answer that, one more thing.

Hosting companies use different terms: aliased domains, parked domains, ...etc. They basically mean the same thing. Visitors to example.com and host1.example.com go to the same directory (public_html for example). If you are using just normal .html files with Apache, then you cannot host different content. They are supposed to display the same content. For example you have the same name with .net, .org and .com, and want them all to be the same content.

Drupal's magic allows us to use multiple domians from one code base, as explained above. (This was one of my criteria for chosing Drupal over other CMS: out of the box multi site functionality).

The term 'add-on domain' from hosting companies means something else, that you have another domain with another directory, so you can run a different set of files.

These terms are not standard across the board. Hosting companies use other terms as well, which adds to the confusion.

One last question: when using aliases, do both domains need to be on the same host? Or can they be on:

a.) different servers with same hosts?
b.) different servers with different hosting companies?

I assume we are talking about the Drupal aspect.

The basic setting in Drupal is that the database and Drupal itself are on the same machine. This is simple enough, and works for 90% of the sites.

In this case, aliasing is no problem.

It does not have to be so for large sites though. One can have the database on one machine (doing only database), and another having the Drupal files, as well as other files (e.g. uploads, images, ..etc.)

One can even be more sophisticated and have multiple Drupal front ends and a single database as the backend. This can be done for load balancing reasons, and DNS can be used to mask the

To answer your question, they all have to be able to access the same database. This means they have to be on the same machine in most cases, but can be on different machines provided they all can access the database.

So, I cannot see how different servers with different hosting companies would work in Drupal with reasonable performance, and no security issues, ...etc..

If you do have domains with different hosting companies you can have a simple redirect to go to the target domain, no matter where they are in the world.
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

venkat-rk’s picture

It does not have to be so for large sites though. One can have the database on one machine (doing only database), and another having the Drupal files, as well as other files (e.g. uploads, images, ..etc.)

This is exactly the way my hosting company works. By default, all databases are on dedicated servers different from the one on which accounts are hosted.

Just a few more clarifications:

1.) Is the multi-site functionality useful if I need to mirror a site, but the domains are different- that is, they are not parked or alias domains but completely different domains such as www.example.com and www.123.com?

2.) Another question is whether a parked or aliased domain would come down if the main domain came crashing down due to heavy traffic or hacking or any other reason?

Thanks again. Frankly, it amazes me that you can spend so much time explaining things to other Drupal users.

iandickson’s picture

My original config was the dreaded "super advanced", and it worked when I used fantastico. Had several Drupals with diff content, diff themes but shared users. I was chuffed.

It made sense because they were related communities - too diff to be one single one, but no one wanted the hassel of multiple sign ups.

However I've pulled it. I ran into problems doing upgrades and it broke. I followed the instructions, but, as is typical with Drupal, there were probbaly others elsewhere I needed, or assumptions about my expertise (low) and so I missed the things that were too obvious for a geek to document :-(

My conclusion - I still want it, but it can wait until I can hire someone who really understands the guts of MySQl and PhP and who I can contract that part of the system management to.

enora’s picture

Hi,

I am trying to configure sites but without a result.
I did all you explai above but it still didn't work.

A domain name that we use is a real domain name or a VirtualHost(that we can configure in the httpd.conf)??

I want to create a diferent sites and with different databases (each sites its own databases).

can you tell me the steps that i forget to do?

Thanks a lot
Enora

green monkey’s picture

Drupal 4.6.2 multi-site, single domain, site specific modules, sub folder config, single code base

When I started this, I thought it was going to be a no-brainer, but I just can't get it to come up

I've done multi-sites before with two differnet domain names:
mobile.site.com and site.com - very clean operation and install. Core team did a great job to make this appear to be a simple task.

but now I'm trying to do this:

http://mainsite.com
http://mainsite.com/subsite

basically I'm looking to get two different front ends and have the need to use site-specific modules

I thought if I just followed the pattern of a typical multi-site. I thought it would come straight up, So my first thoughts are I have a path issue.

structure

/sites/mainsite.com
/sites/subsite

base URL in the two different setting.php's files

http://mainsite.com
and
http://mainsite.com/subsite

Path to mySQL: common

gosh this seems so simple, did I path wrong or can this be done?

I know I can load a copy into a /subdir and have it run, so it seems this should work as well.. but after playing with every possible path - I thought I better ask someone smarter in these matters

thanks

cghobbs’s picture

I believe that the folder name you must create is
/sites/mainsite.com.subsite/
and then it should be simple just like two different domains.

psiegers’s picture

Hi all,

I'm trying to create a second Drupal site on my Windows 2003 host. I'm not able to detect which version I'm using, this would be my first question.

Anyway, I more or less followed the steps given in your first entry of this thread:

I first created a subdomain on my host server called 'camm.pietsieg.com'. Then, I created a second MySQL database called 'camm' hosted on the same server, and executed the script file 'database.mysql'. I also created a subdirectory called 'drupalcamm' under the 'sites' directory, and placed a modified copy of settings.php there. The only modifications I made were these:
...
$db_url = 'mysql://psiegersdr:sanpab43@localhost/camm';
...
$base_url = 'http://camm.pietsieg.com';
...
So far, so good. Now, my main question is how to configure this new subdomain to point to the drupal directory (just like in http://drupal.pietsieg.com which points to http://www.pietsieg.com/drupal) but ***using the other database*** called 'camm' so that it appears ***as a complete different site*** using the ***same code base***?

Sorry if this seems trivial but I'm at loss here... I'd like to know at first if it would be possible, for a start, then where I'm missing something in my configuration.

Many TIA, Pieter

kae’s picture

2bits.com,
thank you for the nice summary

ae2005

free tag: usefulcomments, usefulcommentsae
why the free tag? see
http://drupal.org/node/43452#comment-81080

ti’s picture

I have setup several sites with different domain names running off of the same database with prefixes. But I wanted to learn more about how to do this:

My host can setup folders/subdirectories as subdomains. I can put all the Drupal files in one folder, setup prefixed tables, and run an independent Drupal site. Now, suppose my directory structure is like this:

root/
root/subdir1/

www.example.com (also example.com) points to files in the root/ directory. subdir1.example.com points to all the files in subdir1/ directory.

I have unpacked all the Drupal files in the root folder but there is nothing in the subdir1 folder. After setting up Drupal properly, when I go to www.example.com and example.com, I can get to my primary Drupal site. But even with seperate prefixed tables and seperate settings in the sites folder, when I type subdir1.example.com in the browser, it gives me errors. I know I screwed up somewhere and did not understand everything right. Where am I going wrong?

kbahey’s picture

Try a symbolic link if you are using Linux/Unix.

ln -s root root/subdir1

See if that works.
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

beate_r’s picture

> I have setup several sites with different domain names running off of the
> same database with prefixes.

It appears to me rather obvious that a multisite installation on a single database needs different table name prefixes for each instance, and that otherwise You will merely get an aliased site with potentially multiple styles.

What i did not find is anything how to obtain an appropriate database with multiple prefixed sets of tables. Just two SQL dumps to create a standard installation. Do i really need to edit the table names in such a dump and run it against the database - for each instance i need?

So, how did You achieve this?

cheers,

Michael

P.S.: IMHO, the documentation is clearly misleading and incomplete in this respect. Misleading because it suggests that there is easy and complete multisite support at least to the average user and incomplete because neither the manual nor INSTALL.txt nor the comments in settings.php describe everything necessary to set up a multisite installation.

P.S.S: what will happen if a dedicated module is installed in a single instance a merely multiply aliased site (i.e., one set of tables in one database)? The other instances will try to use it as configured for that single instance and will not be able to reach the code, right? Why no warning in the docs?

kbahey’s picture

Yes, you need to edit the database.* file that you are using and include in it the prefixes.

You would actually copy that file under multiple names, one for each instance you want, and then edit each file and change the table names to have the prefix.

For example:
CREATE TABLE nodes
will become
CREATE TABLE site1_nodes

Do that for every CREATE, and every INSERT.

You need to do the same for every contributed module that you use that requires additional database tables.

You only need this done once, and after that, you can dump the database structure and/or data and keep a copy of it.

When upgrading, you do not need to do anything. the update.php script automatically handles prefixes, but you need to run the update once per site you have.

If you think you can improve the documentation, please do so.
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

beate_r’s picture

Thanks for the info. I have done that with big success. Just two notes:
In addition to CREATEs and INSERTs there a a few REPLACE statements which have to be modified as well. Using, e.g., sed for the replacements You will have to do the following, assuming db_pref_ is Your current prefix:

s/CREATE /CREATE db_pref_/
s/INTO /INTO db_pref_/
s/REPLACE /REPLACE db_pref/

secondly:
IMHO, it is a bit frustrating and not very efficient letting everyone interested in multisite installations first dig through the manual, then through the forums in order to understand whats going on in a situation where a simple recipe (with background info, of course) is possible.

In addition, how hard would it be for the developers to maintain a script (Unix shell/sed or maybe better PHP) to do this and extend the documentation?

If there is interest by the developers i would be able and also willing to do that piece of work.

cheers,

Michael

danielc’s picture

You don't need to edit the database.* files (if you use my Database Table Creation Script). See http://drupal.org/node/20530.

beate_r’s picture

Thank You for the info. You have already done exactly what i have proposed. IMHO such a script should be merged into the official tree, it is simply too important.

Again, this seems to point to problems of the organisation of the manual, doesn't it?

The table prefix stuff is described in the configuration section and not as a part of the installation section although it IMHO clearly is part of a multihome installation and should be moved there. At least it should be cross linked.

What Do You (all of You) think about that?

cheers,

Michael

garm’s picture

i can only agree i seriously think the documentation is realy lacking for multisites, took me alot of days browsing the forums and looking through the handbook (which fails to cover this in a clear way in my opinion) before i found this little gem.

then again im sure alot of people wont agree but i do :)

justin3’s picture

copy that file under multiple names

For example:
CREATE TABLE nodes
will become
CREATE TABLE site1_nodes

do this and then have a directory of separate database files named
drupal
site1
site2
etc?

i thought this method was to use the same database with different prefixes- not different dbs. am i supposed to bundle these files together in a .gz file and then it's one database?

for my new settings.php in site1.com/ i set this value
$db_url = to the default settings.php
$db_prefix = 'site1_'

install.txt makes it sound so easy, just copy the settings.php file- it doesn't say anything about table prefixes etc... is this really necessary?

when i point my browser to mysite.com/sites/site1.com/

403 forbidden error- i checked and it's the same file permissions as the default folder- ah- and i get the same error with default/ - ok so where do i point the browser to see site1.com if i'm just testing this out and i haven't bought site1.com yet?

Lou Quillio’s picture

I have a multiple-domain hosting account at TextDrive. As more of the sites I host there become Drupal sites, it's more important that they share a codebase.

Plenty of databases, and my DNS is handled by a third party (DNSMadeEasy.com).

One of the domains is 'primary' as far as TxD is concerned, but that's generally moot. Nevertheless, the directory structure is like this:

/home
    /public_html  [primary domain]
    /domains
        /domain2/public_html
        /domain3/public_html

Now, I might install the [multi-site] Drupal codebase at any of these domains, take care of settings.php and such, point the installs to differing databases or the same database (with differing table prefixes). That's clear.

Say I installed Drupal in public_html for the primary domain. What's not clear is how best to have requests for the other domains resolve to the primary domain's Drupal code -- so that Drupal can sort-out the URLs and call the right DB. Rewrite rules? Symlinks?

All else is clear to me but this. How would you do it?

LQ

kbahey’s picture

This is a case where you have so called Add-on domains in your hosting account, as most hosting companies call them.

Your hosting company has setup vhost entries for each domain and pointed them to different directories.

Perhaps symlinks will work in this case.

Make a symlink from /public_html to /domains/domain2/public_html and /domains/domain3/public_html, and see if this works.

If that does not work, perhaps asking your hosting company to change the domain2 and domian3 to be just aliases, and that will do the trick.

--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

Lou Quillio’s picture

Thanks for the reply.

It's not really an add-on domain situation. There's no control panel application. I have shell access. The directory layout is simply how TxD organizes [hosting] user accounts. It's all hanging off of my home directory, sure, and the secondary domains are vhosted -- but my primary is ultimately vhosted, too. In short, the domains have no relation to each other for Drupal's purposes.

I mention all of this because I'm hoping to derive a more complete explanation, mostly for the benefit of others. In the docs and discussion of multi-site installs, there's repeated reference to the sites needing to be on the same machine. That's true, but no reason is given. It's not for database access, since it's plausible that Drupal scripts running on Host X could access a DB on Host Y -- if the host allows such access.

I think a more solid explanation (for shared-hosting users) is because you need to make links from /index.php on Y and Z domain to the central /index.php on X domain. Maybe they should be symlinks or hard links; guess I'll have to play around with it.

Anyhow, it seems to me that the reason the sites need to be on the same server is because of the need to make such links at the filesystem level, which ain't gonna happen if they're on different filesystems/servers. Yet I've seen no explicit discussion of what those links should be.

Right now I'm figuring that /index.php for the (let's call them 'additional') Drupal installs must link to the 'real' /index.php where Drupal's really installed. I think your reply, kbahey, suggested the reverse.

I'll experiment. Thanks very much for the reply. Just the opportunity to post here helps gel the thinking. One of the benefits of Drupal.

LQ

Lou Quillio’s picture

Apologies to anyone who already understood this, but to recap:

/home
    /username
        /public_html        [primary domain on hosting account; Drupal here]
            /sites
                /primary.com
                    settings.php        [configuration for primary domain]
                /domain2.com
                    settings.php        [configuration for domain2.com]
                /domain3.com
                    settings.php        [configuration for domain3.com]
                [...]
        /domains
            /domain2.com
                /public_html
            /domain3.com
                /public_html
            [...]

Under /public_html for the hitchhiker domains (Domain2.com, etc.), I needed a symlink to the physical Drupal install:

ln -s /home/username/public_html/ /home/username/domains/domain2.com/public_html

When somebody goes browsing to Domain2.com, they actually end-up (filesystem-wise) at the true, physical installation of Drupal in my primary domain's /public_html. They don't know it, or need to. Their browser doesn't know it, and preserves the URL they requested.

Drupal then takes over. Instead of presenting the Drupal site for my primary domain, it first examines the URL to see if it knows alternate settings for the domain requested. If it does, it uses the alternate db connection string and $base_url, and anything else in settings.php for the alternate domain. Done.

In fact, I don't have 4.6 installed in /public_html for the primary domain; rather, it's one-off in a directory called /drupal46. That way I can install a later Drupal version sometime without disturbing the 4.6 sites.

If some of the hitchhiker domains are in testing, I make a different symlink to a false directory (filesystem and URL) in the hitchhiker domain. So, considering these last two points, the symlink might be this:

ln -s /home/username/public_html/drupal46/ /home/username/domains/domain2.com/public_html/testing

This way, when somebody browses to Domain2.com/testing/, they get a different Drupal implementation than when browsing to Domain2.com/.

The only trouble I see with this is that Drupal's multi-site functionality might not abide discrete settings for Domain2.com and Domain2.com/testing. Or maybe it will. In any case, subdomains are supposed to work, so that's an option for testing a new site concurrently with a live one.

And, of course, I could later install Drupal 4.7 (!) in a directory alongside 4.6, tweak the symlinks, and try it out live.

LQ

Lou Quillio’s picture

This turns out to be a sub-optimal solution. For the hitchhiker domains, if I want them to be available from the docroot, it's necessary to replace public_html with a symlink to the physical Drupal install. That means no other files can reside in the web tree. Natch I could make all manner of additional symlinks, but that's ... not ... really ... ideal.

So to preserve a physical public_html for each domain sharing the Drupal install, it's been necessary to set a base_url in settings.php of something other than webroot. If for instance I say that the base_url is ://domain2.com/site and have a symlink called `site` that targets the physical Drupal install, everything's cool.

But then we're back to the old problem of every Drupal-generated internal link having a superfluous subdirectory in the URL. In my example, everything will be domain2.com/site/...

I've never seen a satisfactory solution for this, but there must be one. A set of rewrite rules could maybe do the job. Essentially, the rules would instruct Drupal to follow the symlink for all requests to:

/database
/includes
/misc
/modules
/scripts
/sites
/themes
cron.php
index.php
xmlrpc.php

... and have it stay put for anything else. Then again, maybe symlinking each of these explicitly (rather than the whole directory) would work.

LQ

wosonj’s picture

very clearly put, brilliant workaround. Please include this post in the manual as an example - the descriptions in both install.txt and the manual are very bad and did not help me in any way. Install.txt is actually imho misleading on multisite setup.

I only add that if you cannot telnet to your webhost, you can create the symlinks using PHP's system() function.

jdmquin’s picture

You need to point the domains at the same directory, the directory drupal is installed in. If you're not sure how to do this contact your Web host provider. I use 1and1 and there is an administration panel to set the directories domains point to.

Thanks

JJ

Lou Quillio’s picture

Thanks for the reply, jdmquin.

What I'm talking about is language like "point the domains." It's nebulous. What's for sure is that I don't wanna alias (from a DNS or an Apache perspective) the hitchhiker domains to the one where the Drupal codebase is installed.

Different hosts use different terminology, and maybe assume you're using their DNS or control panel metaphors. I'm trying to come up with instructions that skirt these variances and simply say what's happening. And I think it's that /public_html/index.php on a hitchhiker domain (assuming Drupal's supposed to run from the domain root) should be not a file but a filesystem link to the physical /public_html/index.php of the physical Drupal install.

But we can't just say "point/alias/link/directory", because that means varying things in hosted environments. Tell folks to "alias" and next thing you know the MX traffic from one domain is sent to another. Somewhere at the bottom of this is what's really happening, and I'm gonna find it.

LQ

kbahey’s picture

I assumed shared hosting, since this is the most common type people will use.

Just to recap for everyone, here is how a domain works:

1. You register the domain. The company you pay yearly for the domain registration fee is the registrar.

2. The registrar points your domain to a DNS Server. Most registrars allow you to set the DNS Server yourself. This way, you can get the DNS service from a third party, such as EasyDNS or Zoneedit.

3. The DNS Server points your domain to an IP Address. This is normally an address that your hosting company assigns to you.

4. The IP address may be dedicated to your domain, or shared with other domains (either yours or someone else's).

5. The hosting company assigns the IP address and/or domain name to a vhost (virtual host).

6. This vhost points the domain to a directory. This is where Drupal is installed in most cases.

So, to recap: domain name -> DNS Server -> IP Address -> vhost -> directory.

In most shared environment, you do not control the vhost configuration, and hence the directory assigned to your domain(s) is fixed. If you have an aliased/parked domain, then it will go to the same directory. If you have an add-on domain, then it will go to another directory.

Drupal allows us to convert aliased/parked domains to something like add on domains, without paying for it.

The same basic idea applies to dedicated servers (whether they are real machines or Virtual Private Servers), but YOU DO CONTROL the vhost, and hence can assign directories as much as you like.

I agree with you that the lack of standard terminology in the hosting business is causing a lot of confusion. But that is not something we can solve ourselves, and we have to live with it, for better or for worse.
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

brettpappas’s picture

Does anyone know how to configure each so that the "external" directories are separate? In other words, if they all share the same document root (via vhosts or soft-links) then what happens when both sites set up an uploads/attachments folder as "/files"?

Wouldn't they stomp on each others files?? The only way around this would be to setup drupal in a sub-directory off of the document root which means your website has to serve all of it's drupal content with a url like http://mysite.com/drupal/ instead of just http://mysite.com..

Anyone know how to avoid this?

killes@www.drop.org’s picture

True, they would save the files in the same folders. But you could simply name the directories differently or use some mod_rewrite tricks. Drupal will always check if files exist, but sharing the files/ directory is a bad idea for example for user pictures.
--
Drupal services
My Drupal services

brettpappas’s picture

I definitely see why it is a bad idea which is why I want to avoid it. I also see where the current rewrite rules check for the real file first but I don't see how that solves this problem.

How would you prevent two different sites from specifying the same path? Seems like you need a way to make that path be relative to a different path based on the user. The only way I know of doing this is by using different document_roots for each site and the setting up drupal as a sub-folder like I mentioned previously.

Maybe there isn't a way around this..

killes@www.drop.org’s picture

What you could do is to hardcode the files directory in the settings file.

$conf['file_directory_path'] = '/var/www/....';

In this way the user cannot change the value in admin/settings.
--
Drupal services
My Drupal services

brettpappas’s picture

Thanks! This might do the trick, I take it that I will need to have 'private' download method enabled..

killes@www.drop.org’s picture

You can set any variable in the settings file. You just need to set it to the right value, my example was for private downloads.
--
Drupal services
My Drupal services

saml’s picture

Thank you kbahey and Lou Quillio for explaining what the "additional site functionality" really is about. Reading your overview I finally got all the things clear.

I think that reading from post http://drupal.org/node/20663#comment-35402 and through your overview above, is a good suggestion to anyone wanting to get an overview of this.

jdmquin’s picture

I'm in the process of moving my sites to 4.6. I'm using the multi-site feature (which is great!). I'm curious how others are setting up both live and test sites. I assume that test versions of your site you would want in a separate directory so you can play with new versions of drupal and modules without affecting your live sites. I use 1and1 and I have setup subdomains to help with this.

Main directory - htdocs/drupal
Test directory - htdocs/test

www.example.com & example.com point to htdocs/drupal.

I also have a domain name for testing and I have setup subdomains on my test domain name to point to the test directory

exampletest.domain.com - point to htdocs/test

I also put a password on the test site.

Any other ideas?

Thanks

JJ

kbahey’s picture

I know this is not the answer you are looking for, but I prefer my test site to be on a different machine altogether.

It can be the same machine you are posting from right now. Windows, Mac or Linux does not matter a lot, they all work with Drupal to a large extent.

This way, it does not eat into disk space or bandwidth, and if you have a script that goes crazy and eats up CPU time, it does not bring the entire machine down with it.

That being said, a test site in a subdirectory is possible. I have not tried it myself (you can guess why from what I wrote above), and hence will leave the answer to someone who did.
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

green monkey’s picture

I never knew that, I thought I had to have some flavor of a unix box to run a Drupal on.

gee that would be great, I get real nervous with some modules.

do I have to create some type of shell to run drupal? I'm not expecting you to walk me threw this, but if you could point me in some direction to "solid" info on how I can this, it would be appericated. you seem to have a great handle on this stuff and would know the difference between good advice and not so good advice

wow!!! this would be a very good thing to have and use

would this be good?
http://drupal.org/node/9407

kbahey’s picture

I personally do not run it on Windows, but others have done so successfully (I think sepeck is one of them, I also think he runs IIS).

You don't need a shell. All you need is PHP, MySQL and a web server (Apache or IIS). That is all you need.

Here are some links that may help.

http://drupal.org/node/270

http://drupal.org/node/265
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

JezV’s picture

...works fine.

I run my test site on my desktop using WIn XP SP2, Apache, PHP and MySql and my live site on linux. I simply ftp the program files to the web server, dump the MySQL database to a text file and use MyPHPAdmin (supplied by the hosting co) to import the sql text file, with all its data, structure etc intact.

Magic!

Only thing that caused a problem was getting the firewall to let Apache and my ftp client through.

jdmquin’s picture

Bye the way using this instead of IIS just to make sure I match my live server. Although I do think apache is a much better web server.

Thanks

JJ

jdmquin’s picture

I found several PHP development packages for Windows that install Apache, PHP and MySQL. They are:

EasyPHP - http://www.easyphp.org/telechargements.php3

phpdev - http://www.firepages.com.au/

XXAMP - http://www.apachefriends.org/en/xampp.html

Based on this discussion I am going to move my development environment to my PC and try XXAMP since it has the latest software.

Thanks

JJ

phatPhrog’s picture

So what does one have to do to get Multi Sites like Bryght has?

Is that part of the affiliate module or is it a custom job I'd need to hire someone to perform for us?

Boris Mann’s picture

Anyone can run multiple sites using standard Drupal codebase. You just have to manually do all the setup etc., which we have automated with our provisioning system.

We are, by the way, perfectly willing to work with people that want to use our provisioning code to run hosting systems of their own.

phatPhrog’s picture

I contacted you about it. We are looking forward to hearing from you.

phatPhrog’s picture

My thanks to you anyway.

m_freeman2004’s picture

Hi,

I want to have multiple subdomains with DIFFERENT content in different languages - in their own databases - to share a single codebase in the root directory. eg.

example.com - Drupal 4.6.0 with content in database_www
en.example - content in database_en
fr.example.com - content database_fr

So if I understand it correctly the directories would look like this

public_html/
sites/en.example.com/settings.php with base_url=example.com
sites/fr.example.com/settings.php with base_url=example.com

en/ deleted and symlink en.example.com -> example.com
fr/ deleted and symlink fr.example.com -> example.com

N'est pas?

Marcus.

kbahey’s picture

To do this, you need to have:

sites/en.example.com/settings.com with base_url en.example.com
sites/fr.example.com/settings.com with base_url fr.example.com

If you want them to be in the same database, then make a db_prefix for each (e.g. en_ and fr_)

If your default site (example.com or www.example.com) will be english, then you can alias it to en.example.com. In other words, do a symbolic link from en.example.com directory to example.com and www.example.com

There is no need for the extra /en or /fr in the urls, so DO NOT DO en.example.com/en or fr.example.com/fr

Clear?
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

m_freeman2004’s picture

Hi,

If you want them to be in the same database, then make a db_prefix for each (e.g. en_ and fr_)

I don't want to have them in different databases, but in their own. I've got 40 subdomains and 20 databases to play with so resources are not an issue.

At the moment I'm doing this...

database_en    - Drupal -  en.example.com 
database_www - Drupal - www.example.com
database_fr     - Drupal -  fr.example.com

Every time a new version of Drupal comes out I have to update EACH installation of Drupal, which is time consuming and takes a lot of management to ensure all sites use the same themes and modules.

So, I'd like to have all the sites share a common codebase in the www subdomain like this...

database_en  \        /  en.example.com
database_www - Drupal - www.example.com
database_fr  /        \  fr.example.com

Is this possible?

Regards,

Marcus.

killes@www.drop.org’s picture

Yes, that it easily possible. ust set up Apache to point to the same directory for all subdomains.
--
Drupal services
My Drupal services

m_freeman2004’s picture

Hi,

I'm in a shared environment with Cpanel. Can I do the pointing or will the host have to do it?

Regards,

Marcus.

killes@www.drop.org’s picture

Sorry, I don't know if this is possible through cpanel. I guess it should, though. read the instructions about creating subdomains.
--
Drupal services
My Drupal services

m_freeman2004’s picture

Hi,

Just to let you know that my hosting company and I finally worked out how to do this. The trick was to include a directive in the apache httpd.conf. The process goes something like this...

a) Create an installation of Drupal at www.example.com with

* sites/default/settings.php with the following settings
o $db_url = 'mysql://username:password@localhost/database_www';
o $base_url = 'http://www.example.com/';

b) Create subdomains eg. foo.example.com

c) Create databases eg. database_foo and upload tables

d) In www.example.com create...

* sites/foo.example.com/settings.php with settings
o $db_url = 'mysql://username:password@localhost/database_foo';
o $base_url = 'http://foo.example.com/';

e) This is the cool bit! We asked the hosting company to edit the Apache httpd.conf file to point all requests for foo.example.com to www.example.com.

The directive looks something like this.

<VirtualHost 12.34.56.78>
BytesLog domlogs/foo.example.com-bytes_log
ServerName foo.example.com
ServerAlias www.foo.example.com
ServerAdmin wwwadmin@example.com
DocumentRoot /home/username/public_html/
CustomLog domlogs/foo.example.com combined
ScriptAlias /cgi-bin/ /home/username/public_html/foo/cgi-bin/
User username
Group username
</VirtualHost>

I hope this helps those going through the same agony I did!

Regards,

Marcus.

gossamerLL’s picture

I'm very interested in Drupal for one of the sites I maintain. It is a non-profit site that is organized into six affiliate sites all maintained on one webspace. www.canterusa.org. Right now I have all my volunteers using various tools for updating the site and uploading our horse listings and I keep thinking a good CMS is what I need.
I'd like to maintain the overal URLs and look of each site if possible.
www.canterusa.org
www.canterusa.org/michigan
www.canterusa.org/ohio
etc.

A couple of questions on if this can be done with Drupal.
Each site keeps own look (theme) and individual content.
Display shared content for horse listings on each site.
One database
Don't allow users to add content to the site unless in an Admin group.
Separate Admin groups for each site.

Would I use table prefixes to set this up correctly?

My main concern is that all the sites want to share the horse listings but they want to keep their own theme when displaying the listings.

Any input on how I might set this up with Drupal would be great.
Thanks,
Linda

sengsara’s picture

What I did was:
1. The main site is : www.site.tld/main
...www/main/ -- This is where Drupal resides.

2. Second site: www.site.tld/second
...www/second/ -- just an empty directory.

2. Third site: www.site.tld/third
...www/third/ -- another empty directory.

I then create a .htaccess file inside the root directory (...www/)with this inside:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /

  RewriteRule ^second/(.*)$ main/$1 [L,QSA]
  RewriteRule ^third/(.*)$ main/$1 [L,QSA]
</IfModule>

Problem is the main site is in www.site.tld/main (instead of www.site.tld).
Or maybe anyone can show us how to do this with the Drupal code in the root directory?

Anonymous’s picture

I have a similar thought to Linda's ... the multi-site efforts are great, but is any development effort being applied toward having end-users initiate "site creation requests"? I have in mind:

  • project sites
  • personal sites (not just a personal page anymore!)
  • department sites

Each with separate users/permissions. Creatable by users from templates for appropriate task. Seems we're well on that path, but is this sort of idea being worked on?
Bill

eka’s picture

Hi all

I'm trying to run two drupal from same codebase like this

www.mysite.com
www.mysite.com/foo1 (another site)

so i set up everything in drupal

sites/mysite.com.foo1

inside there i have the settings.php pointing to another database

so the next step missing is Apache .... what shoul i put in httpd.conf

i tryied

...
Alias /foo1 /var/www/drupalroot

so at first works but when i log in... i goes to the root again
www.mysite.com

if i check all the menu links are /foo1/admin and so on so they have foo1 appended but it's not working properly

does anybody set this up properly ... surely i'm doing something wrong

thx in advance

Eka

igy-1’s picture

This is exactly what I'm trying to do also

I have a drupal site at mysite.com
I want to have a different site at mysite.com/site2 using the same drupal codebase

i have sites/mysite.com.site2/settings.php configured correctly
but drupal is still sending requests for mysite.com/site2 to the default site...?

any ideas?

crac’s picture

are you using the same database for both drupal instances? if yes, then you will get the same content, unless you work with table prefixes ...

bplat’s picture

I have a working, private, Drupal installation on
http://server.domain.com

I want another site, entirely unconnected, with its own database, on
http://server.domain.com/company

I created another database (step 2-3 of the installation instructions). I copied the sites/default/settings.php to sites/server.domain.com, and to sites/server.domain.com.company. I modified the db_url and base_url in the latter settings.php file to connect to the correct database.

Now, when I go to
http://server.domain.com
all is as it should be. No wonder, since I haven´t changed a thing. But when I go to
http://server.domain.com/company
I get an error message:
Object not found! The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

So I assume I must do something to the Apache configuration. But what?

crac’s picture

First you must create symlink for the new subsite, so that apache thinks this is a directory (I hope you are using linux, because I dont know how to do that in windows): Enter the drupal installation directory and enter the following statement:

ln -s . company

The second step is to change your .htaccess file or apache will redirect you always to the main page:

...

RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
RewriteRule ^company/(.*)$ company/index.php?q=$1 [L,QSA]

I hope that works for you too. Unfortunately the friendly URL rewritting wont work for the company subsite. I have to do some further investigation on that issue ...

robertDouglass’s picture

It seems like Apache has to offers some other method for saying that the server.domain.com/company URL should share the same docroot as server.domain.com.

- Robert Douglass

-----
Rate the value of this post: http://rate.affero.net/robertDouglass/
I recommend CivicSpace: www.civicspacelabs.org
My sites: www.hornroller.com, www.robshouse.net

bplat’s picture

I added this to my httpd.conf:

Alias /company /srv/www/htdocs

and I´m in business. :-)

crac’s picture

perfect ;) does friendly url rewriting work for both of your sites this way?

seannyob’s picture

No, mod_rewrite would require more a more sophisticated ruleset in .htaccess for that to occur on sites with subdirectories as described in this thread, using the apache Alias directive solution.

In fact, I just implemented that and drupal spit out an error that mod_rewrite was not properly configured on my secondary site, that is, it's working on www.example.com but not www.example.com/test.

I'll work on this and post the solution.

--
Sean K. O'Brien
CTO
Colley Graphics, LLC
http://www.colleygraphics.com

Walt Esquivel’s picture

Hi Sean,

Was your response in reply to my post? http://drupal.org/node/20663#comment-50700

Your response appeared ABOVE my post so I wasn't too sure...

I appreciate any feedback and look forward to your helpful comments in order to help guide me as to what my next steps might be with regard to setting up my web site with its geographically dispersed chapters.

---------------------------------------------------------
Walt Esquivel, MBA, MA, Captain - U.S. Marine Corps (Veteran)
President, Wellness Corps, LLC
---------------------------------------------------------

Walt Esquivel’s picture

Hi – any help GREATLY appreciated. When you answer, please cite the actual number you’re replying to (e.g. #1, etc.). Thank you! Oh, I'm not sure if this matters but I'm using Drupal 4.6.3 on a Linux server, Apache version 1.3.33 (Unix), Perl version 5.8.6, and PHP version 4.3.11.

1. Other than appearance and everything else being equal, is there any real difference between the following two subdomain formats? They should work pretty much the same, shouldn’t they? I prefer the first subdomain format but can work with either.
newyorkcity.mysite.com
www.mysite.com/newyorkcity

2. I want each of my city chapters (New York City, London, Madrid, etc.) to have its own look and feel (theme) and content. I need the ability for each city chapter to have its own administrator and for each administrator to ONLY be able to control his/her specific city chapter and NOT be able to log in to any other city chapter in an admin capacity. So far, are we talking one database or more than one?

3. Using cpanel to create my databases and subdomains, my database URL format and base URL formats for www.mysite.com are as follows:

$db_url = 'mysql://myusername:mypassword@localhost/mydatabase';

$base_url = 'http://www.mysite.com';

My database URL format and base URL formats for newyorkcity.mysite.com are as follows:

$db_url = 'mysql://myusername:mypassword@localhost/mydatabase';

$base_url = 'http://newyorkcity.mysite.com';

The www.mysite.com web site works and it appears I have the newyorkcity.mysite.com web site database set up correctly and identical to www.mysite.com (same username, same password, same database) except for the base URL , but why do I get this for the newyorkcity.mysite.com web site?

Forbidden
You don't have permission to access / on this server.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

4. OK, another twist is that although it would be nice for the city chapters to be able to share SOME content such as job postings, this is not absolutely necessary, just a nice to have. Could this “nice to have” option along with all the city chapters all run off of one database even if the answer to #2 above is only one database? If not, would I need 20 databases if I have twenty (20) city chapters? Could they all run off the same Drupal codebase installation?

5. In order to set up and run subdomains the way I want to, a consultant wrote:
"Subdomains for Drupal can be done with mod_rewrite code in Apache's httpd.conf file. Tell every HTTP request for /node/$chapter to redirect to $chapter.mysite.com."

I provided the above info to my webhosting company and they replied:
“You can actually do this from your .htaccess file. Clients on a shared server all share an httpd.conf file. The .htaccess file can be found in your public_html directory - feel free to edit at will. If you break something, you can always comment out a line by placing a # sign in front.”

OK, I’ve opened my .htaccess file (please see below for its contents) and I’ve read through all the postings here but I still don’t understand what I’m supposed to do with the .htaccess file in order to have my subdomains work. I created a newyorkcity.mysite.com subdomain with my cpanel. I’ve also copied the sites/default/settings.php file to sites/newyorkcity.mysite.com. It would be EXTREMELY helpful if you could tell me:
(a) how to tell “every HTTP request for /node/$chapter to redirect to $chapter.mysite.com” and
(b) if your instructions need to be inserted in a specific spot of the .htaccess file.

Thank you in advance,
Walt
---------------------------------------------------------
Walt Esquivel, MBA, MA, Captain - U.S. Marine Corps (Veteran)
President, Wellness Corps, LLC
---------------------------------------------------------

#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.

Order deny,allow
Deny from all

# Set some options.
Options -Indexes
Options +FollowSymLinks

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More exist in sites/default/settings.php, but
# the following cannot be changed at runtime. The first IfModule is
# for Apache 1.3, the second for Apache 2.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0


php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0

# Reduce the time dynamically generated pages are cache-able.

ExpiresByType text/html A1

# Various rewrite rules.

RewriteEngine on

# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
#RewriteBase /drupal

# Rewrite old-style URLs of the form 'node.php?id=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^id=([^&]+)$
#RewriteRule node.php index.php?q=node/view/%1 [L]

# Rewrite old-style URLs of the form 'module.php?mod=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
#RewriteRule module.php index.php?q=%1 [L]

# Rewrite current-style URLs of the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

# $Id: .htaccess,v 1.66 2005/03/20 19:15:00 dries Exp $

cel4145’s picture

Have you tried setting it up without modifying .htaccess? I just setup a subdomain for a Drupal site for someone else in their multisite setup using Cpanel on their host. Cpanel created the subdomain as a subfolder of the root domain. I deleted the folder Cpanel created, replacing it with the symbolic link. Then created the appropriate sites/ directory, and it worked.

sangamreddi’s picture

I am windows user i don't know how to create symbolic link. It would be helpful to me if u can explain how to create symbolic link.

I have created the subdomain through cpanel and now i deleted the folder but i don't know how to create symbolic link.

Thanks in advance

Sunny
www.gleez.com

Walt Esquivel’s picture

Hi,

If you could talk me through using a step-by-step process while using examples, that would be very helpful in being able to set up subdomains with cpanel for my multi-sites.

For example,

Step 1. Go to cpanel and create the subdomain you want.
Step 2. x
Step 3. y
Step 4. z

Thank you in advance,
---------------------------------------------------------
Walt Esquivel, MBA, MA, Captain - U.S. Marine Corps (Veteran)
President, Wellness Corps, LLC
---------------------------------------------------------

cel4145’s picture

YMMV: I've only done this once, and it's from memory.

This assumes that Drupal is installed in the root of the domain and that your cpanel creates subdomains as folders there:

  1. Go to cpanel and create the subdomain you want.
  2. From the command line or via ftp, delete the folder that cpanel created for your subdomain; it should be in the root of your Drupal installation for this procedure to work.
  3. Create a symobolic link with the same name as the folder that that cpanel previously created. From the command line in the root of your Drupal installation, use the following command:

    ln -s . < folder name>

  4. Create your sites/ folder (copy the default one) as with any other multisite config using the full name of your subdomain. For example,

    sites/<yoursubdomain>.<yourdomain>.com

  5. Configure your settings.php file that is in your new folder.
sangamreddi’s picture

Hi

Thank You for your step by step guide.

Now i got stuck with the symbolic link command ftp is not accepting the command
In -s . < folder name >

For this do i need to apply for shell access or can be done through ftp?

Sunny
www.gleez.com

cel4145’s picture

I don't believe that there is anyway to do this other than at the command line.

sangamreddi’s picture

Thank You

I asked the hosting company to activate shell access on my account, they said they will activate SSH access on my account.

Once again Thank You

Sunny
www.gleez.com

sangamreddi’s picture

Thank you very much for your guidance, my multisite environment is working from single codebase.

Thank you for all the guys who helped me.

Sunny
www.gleez.com

Kent Stanley’s picture

You don't really need shell access to execute that command. Try this article. That explains the use of the php symlink() function to overcome shell access problems.

povinho’s picture

Hi!

I've also cPanel and no Command Shell access...

I'm sharing the hosting with a friend that has a Manbo site on the Root (public_html).

So I 've a add on working domain www.domain1.com on on a domain1 folder.
Now I've created a new sub domain domain www.domain2.com, and the cPanel created a domain2 folder.

There is any way I can use the domain1 folder has my root folder for Drupal installation and pointing the www.domain2.com to the domain1 folder?

I will use a separated database.

Thank you in advance.

povinho’s picture

On Cpanel I added the www.domain2.com has a addon domain pointing to the domain1 folder.

Created the sites\domain2.com\settings.php
settings.php:
$base_url = 'http://domain2.com
$$db_url = 'mysql://user:password@localhost/user_domain2'

Also created a \files2 folder so the domain1.com and domain2.com don't mix files.

Now any one knows how to let users from domain1 log on domain2 and vice versa, without using the same database?

Thank you in advance.

sepeck’s picture

Read here and experiment on test sites
http://drupal.org/node/2622
It's a manual, custom configuration.

-sp
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mount

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

Walt Esquivel’s picture

OK, here is a sign of my newbie-ness. ;)

Is the character you're using in your command "ln -s" an "l" as in the first letter of late, or is the character a "1" as in the number? Or is it some other special character as it appears to be at http://drupal.org/node/20663#comment-35417? I can see from that last URL that it's not the number 1 yet it appears to not be the lower-case letter L either. I'm using PuTTY to be able to type commands at the command line prompt.

To further complicate things, another post at http://drupal.org/node/20663#comment-51656 makes the character appear to be a capital i as in "I". I just don't want to be typing in the wrong commands!

Also, where you have < folder name> am I simply typing the word "austin" without the brackets? Example:
ln -s . austin

THANK YOU!!!

---------------------------------------------------------
Walt Esquivel, MBA, MA, Captain - U.S. Marine Corps (Veteran)
President, Wellness Corps, LLC
---------------------------------------------------------

ezheidtmann’s picture

Its a lowercase L. And yes.

kae’s picture

Charlie,
thank you very much for carefully writing all this out.
ae2005

dmitrig01’s picture

What do you mean by < folder name >?

rebaf’s picture

I'll concede I must be doing something wrong or have missed something in the forums but I just can't see it.

I undestand the structure of the sites directory and the requirements of settings.php. What I don't get is how settings.php for a subdirectory site is even invoked.

I'm attempting to use a subdirectory site called site1 within a domain say mydomain.com. The primary domain mydomain.com works correctly - shows themed content as I expected. But if I enter mydomain.com/site1 into the browser address bar I get a "page not found" message. If I look in the drupal log it says it can't find page site1.

Some of the forums talk about symbolic links but elsewhere it says this isn't required in 4.6.x - I'm running 4.6.3.

Any inisghts would be appreciated.

Chris

moggy’s picture

you are not alone.

I can get default, www.xai-corp.net, and text.xai-corp.net to work, but not www.xai-corp.net/whateverthehellIwantsite2 to work.

same problem "page not found"

crac’s picture

It is not required to use symbolic links, but then you need to create so called Alias directives in the apache config for these subsites. Apache will treat those aliases as symbolic links. So you have these two choices ...

I also have to say that the documentation about that important feature is very confusing ...

--
my httpclient for uploading whole directories to drupal image galleries (image.module)

yelvington’s picture

To run multiple sites off a common codebase, you configure your Web server to deliver ALL the sites in question from the same htdocs directory. Forget everything you know about traditional virtual hosting and just do it the way the Drupal documentation says. Don't set up a bunch of symbolic links. Just instruct the server to deliver all of the Drupal sites from the same directory.

Drupal reads the site name and the path from the HTTP request header and uses the site name to attempt to locate a corresponding settings.php file. If it is not successful, it uses sites/default/settings.php.

The settings.php file documents the rules Drupal follows in its attempt to figure out which settings file to read.

Drupal then processes the request, remapping any URLs (such as directory paths) as needed.

For www.example.com, create
sites/www.example.com/settings.php

For www.example2.com, create
sites/www.example2.com/settings.php

For www.example.com/foo, create
sites/www.example.com.foo/settings.php

moggy’s picture

ok, that's what I've been doing.

2 questions

in the settings.php file, what is the base url for a site at www.example.com/foo?

"http://www.example.com/foo"?

Is there anything that needs to be enable in the server, an apache module or something, for this to work?

icecoldinfo’s picture

Hi can someone xplain me how you can configure your webpage to deliver all sites from the same htdocs directory?

Stephen Winters’s picture

Quote: Hi can someone xplain me how you can configure your webpage to deliver all sites from the same htdocs directory?

Yes!! I'd like to know this also. and Where is the "htdocs directory" and What does that mean, to "deliver all sites from the same htdocs directory"? Could someone give step by step instructions? Also see my other comment here http://drupal.org/comment/reply/260/51999 about trying to set up multiple Drupal websites

Stephen

sepeck’s picture

That is a web server question not a Drupal question. I believe that the key words you are searching for are Virtual Host. Point the domain name to the root directory where you have extracted Drupal. If the linked docs do not match the web server version you are looking for, then you can use it as a starting point.

-sp
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

sangamreddi’s picture

You need to configure Apache httpd.conf file to acheive this.

Another way is to create symbolic links.

Sunny
www.gleez.com

yelvington’s picture

In answer to Moggy's other question
"http://www.example.com/foo" is exactly what you should put in the settings.php if that's the URL of your Drupal site.

crac’s picture

I am not sure but this did NOT work for me!!! As I understand from this thread all people are useing either ALIAS or SYMBOLIC LINKS ...

--
my httpclient for uploading whole directories to drupal image galleries (image.module)

sangamreddi’s picture

Can you explain in detail what you did?
So that i can help you.

recently i have created a multisite environment with single code base, on a test server i am running with windows and on production server i am running with linux. both are running perfectly.

Sunny
www.gleez.com

cluckk’s picture

Been doing just that and it does not work. I have been wracking my limited brains out trying to get multisite to work. Here is what I am attempting:

(By the way I am on a shared server with ssh and c-panel access)
I have drupal in my root directory: /home/myname/public_html/

I'll call this www.main_site.com

I am attempting to use add on domains for two (at first) other sites to use the same code base. I'll call these:
www.second_site.com and www.third_site.com

All domains are registered and pointing to the right name server.

My provider creates add-on domains with a subfolder in ~/public_html

Example:

~/public_html
        second-site-com/
        third-site-com/

Here is what I have tried with results:

I have used redirect through my provider to redirect each site to their respective sites/folder. For example: www.third_site.com redirected to http://www.main_site.com/sites/third_site.com/

I followed the INSTALL.txt to the letter in regards to the settings.php files.

This ended up with the drupal front page saying Page Not Found

Yes I followed the instructions exactly. If I don't do the redirect of some sort then nothing.

When this didn't work I noticed all the instructions involving symlinks.

I have tried changing sites/example_site.com to a symlink pointing to the folder created by my provider.

I have tried going the other way around and symlinking the providers folder back to the sites/exampl.com folder.

With each of these I got a Forbidden page along with a server error.

I have also tried using a symlink in the add-on domains folder pointing back to the main install:
ln -sf ~/public_html ~/public_html/example-site-com

This simply called the main site--same configurations and all.

I am at a loss here, but will keep trying.

Perhaps I need the Idiot's Guide to Drupal Multisites.

Perhaps the secret is in the .htaccess file. I know little about configuring apache--perhaps its time to learn.

You say: "configure your server to deliver ALL the sites in the question from the same htdocs directory."

I have been unable to find out how to do this, especially in a shared account without root access to the server. Could you show me or point a thread out to me.

nbd’s picture

UPDATE:
Just found out http://drupal.org/node/23260. it solves the problem (below) for me.

I tried to install multi- site on my windows installation. It didn't work despite implementing all the fixes in other posts.

When trying to reach localhost/abc I always got the default installation .

I debugged it and found that the problem is in bootstrap.inc line 52
" $uri = explode('/', $_SERVER['PHP_SELF']);"

As it turns out. there is a bug in php and PHP_SELF when used with CGI returns only the filename without the path (which is what's needed for drupal).

Check http://bugs.php.net/bug.php?id=31843 for details.

I'm now trying to find a solution for this bug. If you have a solution please post it.

Hope it helps.
Nir

ppontes’s picture

In my windows/apache/php/mysql installation $_SERVER[REQUEST_URI] holds the path for the page requested so the following tweak bootstrap.inc worked for me:

  $URI = $_SERVER['REQUEST_URI'] . $_SERVER['PHP_SELF'];
  $uri = explode('/', $URI);

this way I constructed a $uri with the expected string.

Now if someone reads this can they tell me if they got multi-sites in subdirectories working under windows?

I've tried a "shortcut" (windows symbolic link) with the name of the subdirectory pointing back at the root but it doesn't work for me, if I set $base_url = 'http://localhost/testsite' i actually get the first page but no themes and none of the links work.

Of course the status bar show that the links are constructed correct (e.g. http://localhost/testsite/?q=user/register) but apache doesn't take me there.

I'd like a solution that doesn't involve messing with aliases (unless I'm able to set them on .htaccess) since I intend to move my installation to a linux server where I don't have shell access.

sepeck’s picture

multisite working on Windows with both IIS and Apache out of the box with no tweaking of code. I did the Apache merely out of curiousity once as I normally run IIS.

-sp
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

nbd’s picture

I had the same problem. Found out that

LoadModule rewrite_module modules/mod_rewrite.so

line should be un-commented in the Apache conf.httpd file

Good Luck,
nbd

nbd’s picture

Hi,

I have multi sites working with seperate system file for each sub-site.

I want to share the settings so that any change in the setup of the sites will apply to all sub-sites.

For this I changed settings.php as follows:

for the default site:

$db_prefix = array(
'default' => 'main_',
'system' => 'shared_',
'authmap' => 'shared_',
'profile_fields' => 'shared_',
'profile_values' => 'shared_',
'role' => 'shared_',
'sequences' => 'shared_',
'sessions' => 'shared_',
'users' => 'shared_',
'users_roles' => 'shared_',
'users_uid_seq' => 'shared_', // for pgsql
);

and for sub-site:

$db_prefix = array(
'default' => 'abc_',
'system' => 'shared_',
'authmap' => 'shared_',
'profile_fields' => 'shared_',
'profile_values' => 'shared_',
'role' => 'shared_',
'sequences' => 'shared_',
'sessions' => 'shared_',
'users' => 'shared_',
'users_roles' => 'shared_',
'users_uid_seq' => 'shared_', // for pgsql
);

I renamed 'system' table to 'shared_system'

Now I get the following errors:
user error: Table 'drupal.system' doesn't exist
query2: SELECT name, filename, throttle, bootstrap FROM system WHERE type = 'module' AND status = 1 in C:\projects\PMAGZ\includes\database.mysql.inc on line 72.

user error: Table 'drupal.system' doesn't exist
query2: SELECT filename FROM system WHERE name = 'filter' AND type = 'module' in C:\projects\PMAGZ\includes\database.mysql.inc on line 72.

user error: Table 'drupal.system' doesn't exist
query2: SELECT filename FROM system WHERE name = 'system' AND type = 'module' in C:\projects\PMAGZ\includes\database.mysql.inc on line 72.

user error: Table 'drupal.system' doesn't exist
query2: SELECT filename FROM system WHERE name = 'user' AND type = 'module' in C:\projects\PMAGZ\includes\database.mysql.inc on line 72.

user error: Table 'drupal.system' doesn't exist
query2: SELECT filename FROM system WHERE name = 'watchdog' AND type = 'module' in C:\projects\PMAGZ\includes\database.mysql.inc on line 72.

I checked and all the 'system' in the queries are with curly brackets.

Any help is appreciated.

Nbd

traiecto’s picture

NB: This is a duplicate post. I resubmitted it as a new topic to the installation forum.


Hello,
I have a wamp environment setup (wamp5.0) up and running.
Have just downloaded Drupal 4.6 and installed it in a subdirectory of www (where localhost = www)
Inside the "www" folder have the following hierarchy of folders:

  • drupal-4.6.3
    • sites
      • default
      • personalWebsite
      • workWebsite

Before I start making changes to configuration files and seriously messing it all up, would appreciate immensely some advice on how to procede.

1) Must i alter the .htaccess file in Drupal's root to change the Error Document to /drupal-4.6.3/index.php and the RewriteBase to /drupal-4.6.3? (so Drupal is recognised inside a subdirectory?)

2) Must I place a copy of the settings.php in each of the new project folders (the websites-to-be), then change the $base_url in each one of them?

3) The manual talks (and so does the forum) about "multiple domains or vhosts using different databases), and it says i can setup multiple configuration files in my includes-directory.

$ ls -l sites/*/.php
-rw-rw-r-- 1 drupal drupal   sites/www.yourdomain1.com/settings php
-rw-rw-r-- 1 drupal drupal   sites/www.yourdomain2.com/settings php

Do I have to make these changes, substituting the "www.yourdomain1.com" with the folder name? (i.e. personalWebsite)

4) How do I go about creating the databases? (as each project would need its own database?) (NB: I'm using phpMyAdmin)

5) Which changes (above-mentioned or other) must I make and in which order?

Many thanks for your patience and help!!

JezV’s picture

I read this thread from end to end and eventually worked out how to get multiple sites working on my local machine. All the clues are in the thread but I thought it would be useful to put everything together in one item.

Anyway, here's how I got mutltiple sites working on localhost using Windows XP. This should work with Drupal 4.6.x and assumes that you have PHP, Apache, MySQL, phpMyAdmin and Drupal all installed and working.

There are four stages to go through, but it's not difficult:

1. Set up your databases, one for each website
2. Set up each website in Drupal
3. Edit the virtual host settings in Apache
4. Update the Windows hosts file

In the following example we will add a local site"http://testsite1" in addition to the default site.

Databases
=========

Firstly we will set up a new database for 'testsite1'

1. Open your phpMyAdmin page

2. Type a name for your database in the 'create database' textbox ('testsite1' is as good as anything) then click the create button. You should get a message to say your database is created.

3. Next we need to add the necessary tables. Click the 'sql' tab, then use the browse option to navigate to the 'includes' folder of your Drupal installation, e.g. c:/www/drupal-4.6.3/includes. Select the file 'database.mysql.inc' then 'go'.

4. phpMyAdmin will run the script and install the necessary tables.

Drupal
======

1. Make a copy of the folder /sites/default and call it /sites/testsite1. i.e. you should now have two folders in your sites folder, default and testsite1.

2. Open file sites/testsite1/settings.php using notepad. Edit the $db_url line to match the database defined in the previous steps:

$db_url = "mysql://username:password@localhost/database";

where 'username', 'password', 'localhost' and 'database' are the
username, password, host and database name for your set up.

3. Set $base_url to match the address to your Drupal site:

$base_url = "http://testsite1";

4. Save the file.

Apache
======

1. Open the apache config file 'http.conf' (it's in the apache/conf folder in Apache 1. I think it has moved somewhere else in Apache2)

2. Scroll to the end of the file, where you will find the virtual hosting setup. Assuming your websites are all located in the folder c:/www then add the following lines (edit the paths as necessary)

NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
   DocumentRoot "C:/www/"  
   ServerName localhost
</VirtualHost>

<VirtualHost drupal.dev>
   DocumentRoot "C:/www/Drupal-4.6.3"
   ServerName testsite1
</VirtualHost>

There are lots of other things you can add into your VHost settings - see the Apache documentation.

Windows
=======

We now need to tell Windows that the domain 'testsite1' is hosted locally, i.e. not to look on the Internet for it. Open the 'hosts' file with notepad. It can usually be found in c:/windows/system32/drivers/etc

Edit the end of the file to read:

127.0.0.1 localhost
127.0.0.1 testsite1

Save the file.

Apache, again
=========

OK, that's (almost) it. All that is left is to restart the Apache webserver. You could reboot your computer but a better way is to open a command prompt window (a DOS window as we used to call it) and type 'net stop apache'. When the service has stopped, restart it using 'net start apache'

Now when you open your favourite browser and enter 'http://testsite1' you should see your shiny new Drupal site, just waiting to be customised.

You can add as many sites as you need by following the process above. Hope this helps.

Jez

Zach Harkey’s picture

Jez, you should submit this to the handbook.

-zach
------------------------
harkey design

: z

Marco Palmero’s picture

Jez pretty much summed up all the stuff I needed to know - I feel as if i just wasted half an hour trying to figure out what the other people were talking about above - with all the symbolic links and stuff...

And by the way... step three shouldn't be using the include file of the database but as per the install.txt:

3. LOAD THE DRUPAL DATABASE SCHEME

   Once you have a database, you must load the required tables into it.

   If you use a web-based control panel, you should be able
   to upload the file 'database.mysql' from Drupal's 'database'
   directory and run it directly as SQL commands.

   From the command line, use (again, replacing 'nobody' and
   'drupal' with your MySQL username and name of your database):

     mysql -u nobody -p drupal < database/database.mysql

---------------------------------------------------------
My Blog - Photography, travelling and University...

JezV’s picture

Just spotted a typo in the VirtualHosts section. The entry should read

NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
   DocumentRoot "C:/www/"
   ServerName localhost
</VirtualHost>
<VirtualHost testsite1>
   DocumentRoot "C:/www/Drupal-4.6.3"
   ServerName testsite1
</VirtualHost>

Sorry 'bout that. It was getting late...

Jez

johnmackin’s picture

Does anyone know how to configure multiple sites when using IIS on a hosted server?

Thanks,
JohnM

sepeck’s picture

Virtually the same way you do it in Apache. Follow the instructions and then add the site name to the IIS site as a virtual host.

-sp
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

johnmackin’s picture

Thanks - that helped.

ericatkins’s picture

The following text was copied from the latest INSTALL.txt. Enjoy

CONNECTING DRUPAL

The default configuration can be found in the
'sites/default/settings.php' file within your Drupal installation.
Before you can run Drupal, you must set the database URL and the
base URL to the web site. Open the configuration file and edit the
$db_url line to match the database defined in the previous steps:

$db_url = "mysql://username:password@localhost/database";

where 'username', 'password', 'localhost' and 'database' are the
username, password, host and database name for your set up.

Set $base_url to match the address to your Drupal site:

$base_url = "http://www.example.com";

In addition, a single Drupal installation can host several
Drupal-powered sites, each with its own individual configuration.
If you don't need multiple Drupal sites, skip to the next section.

Additional site configurations are created in subdirectories within
the 'sites' directory. Each subdirectory must have a 'settings.php'
file which specifies the configuration settings. The easiest way to
create additional sites is to copy the 'default' directory and modify
the 'settings.php' file as appropriate. The new directory name is
constructed from the site's URL. The configuration for www.example.com
could be in 'sites/example.com/settings.php' (note that 'www.' should
be omitted if users can access your site at http://example.com/).

Sites do not each have to have a different domain. You can use
subdomains and subdirectories for Drupal sites also. For example,
example.com, sub.example.com, and sub.example.com/site3 can all be
defined as independent Drupal sites. The setup for a configuration
such as this would look like the following:

sites/default/settings.php
sites/example.com/settings.php
sites/sub.example.com/settings.php
sites/sub.example.com.site3/settings.php

When searching for a site configuration (for example
www.sub.example.com/site3), Drupal will search for configuration
files in the following order, using the first configuration it finds:

sites/www.sub.example.com.site3/settings.php
sites/sub.example.com.site3/settings.php
sites/example.com.site3/settings.php
sites/www.sub.example.com/settings.php
sites/sub.example.com/settings.php
sites/example.com/settings.php
sites/default/settings.php

Each site configuration can have its own site-specific modules and
themes that will be made available in addition to those installed
in the standard 'modules' and 'themes' directories. To use
site-specific modules or themes, simply create a 'modules' or
'themes' directory within the site configuration directory. For
example, if sub.example.dom has a custom theme and a custom module
that should not be accessible to other sites, the setup would look
like this:

sites/sub.example.com/:
settings.php
themes/custom_theme
modules/custom_module

NOTE: for more information about multiple virtual hosts or the
configuration settings, consult the Drupal handbook at drupal.org.

Brothers in Arms - Gearboxed
cooked Gamers
Hushed Casket

seaspy’s picture

could some 1 set a multi site up for me using my hosting nd stuff plz i realy realy dnt undastand email me at

slyrussianspy [at] hotmail [dot] com

animas’s picture

I have several domains, d1.com, d2.com etc. I do not want to share contents, I only need to share user table so that when user signs up in a site, he is also registered for rest of the sites.

Can Drupal multisite feature do this? How?

- Anim

Krotty’s picture

Sites will share users, other tables will different...

sites/d1.com/settings.php

$db_url = 'mysql://user:password@localhost/drupal';
   $db_prefix = array(
    "default" => "d1_",
    "users" => "share_",
    "sessions" => "share_",
    "role" => "share_",
    "authmap" => "share_",
    "sequences" => "share_"
   );

$base_url = 'http://d1.com';

sites/d2.com/settings.php

$db_url = 'mysql://user:password@localhost/drupal';
   $db_prefix = array(
    "default" => "d2_",
    "users" => "share_",
    "sessions" => "share_",
    "role" => "share_",
    "authmap" => "share_",
    "sequences" => "share_"
   );

$base_url = 'http://d2.com';

Certainly you must create corresponding tables with prefixes d1_, d2_ and share_

animas’s picture

Thanks krotty.
What should be the multisite configuration in addition to your code? Or no changes required?

- Anim

Krotty’s picture

I show only part of sites configuration... Don't forget set $db_url variable and php settings ini_set().
Also your httpd.conf must point same directory for d1.com and d2.com

animas’s picture

Is there any stepwise tutorial for my purpose? Or can you give me one since I never used drupal before?

Thanks.
- Anim

Krotty’s picture

Stepwise? No... But you can try make it yourself.

Examine INSTALL.TXT placed in Drupal root directory, part 4. CONNECTING DRUPAL and use posted above settings for your multisite.

fsmedia’s picture

I tried doing this, but for subdomains rather than individual domains. It ended up that the users table wasn't sharing properly and when I tried to change something on the primary domain's users, it would give me a 'You must select at least one role.' error that I couldn't get around. Anyone have a slightly more precise tutorial on how to do a multisite sub-domain install with 1 drupal database?

rport’s picture

Hi.

I have a Mambo site and a PHPBB site each one is on its own domain.

- The Mambo site is my company.
- The PHPBB site is an independent forum sponsored by my company.

I would like to consolidate the two sites under the one Drupal installation. So the forum remains "independednt" but the company has read/write access to the forum...

Each site should have its own distinct look and feel.

The PHPBB forum should remain a classic style forum. The normal Drupal menus etc should be hidden...

The result should be something like

www.my-company-site.com
default drupal installation

www.my-forum-site.com
default drupal installation as a forum

Is this possible?

I have read this lengthy discussion and remain confused.

Russ

simon rawson’s picture

Boy... I wish I new what sym links were... they worked... like voodoo magic!

lekei’s picture

You can now support multiple sites with no configuration with the file at http://drupal.org/node/33581

Each site will be totally independent and share a single code base. It will automatically install any modules (modules that requite patches or files moved will need to have those steps performed at first, of course.

You don't even need multiple config.php files, the one provided will auto-configure for multiple sites (and yes, those can be subdomains or individual domains).

Apathy’s picture

Hello,

I have 5 sites each of which have 90% of the same content but each site needs its own template.

Is there a way to use tag content with which site it should be displayed on?

eg news article #1 appears on site1, 2, 3
news article #2 appears on site 2, 3 , 4 but not on 1
stattic content #1 appears on 1, 3 , 4

Can you think of a way of doing that in Drupal?

James

simon rawson’s picture

One simple solution (though maybe not the best) would be to use taxonomy and to create a vocabulary called "Site". You could then create terms called 1,2,3... etc for this vocabulary and allow each node to have multiple sites and to require at least one.

You could then use a simple php snippet (possibly embedded into a php template, one per site) to only pull out only nodes which are for that site, by taxonomy term id.

jbrauer’s picture

It would be great if we could set the limiting taxonomy term in settings.php. This would seem a simple way to make this sort of arrangement work and make it easy to administer.

--

federico’s picture

Sorry for my english.

I have two sites about economics, one focused in one country (say brasil) and the other is about general economics.

I do not want to share content, i want to share taxonomy, for example, if i write one article about inflation in brasil, i want to use the term "inflation", so in the list of nodes belonging to this taxonomy term of the general economics site, will be also listed the article from the brasilian site.

Is this possible?

www.zonaeconomica.com

franksonck’s picture

I want to have two sites sharing one database but they should differ in respect to the content that is pulled from the db, different modules and blocks on the homepages, different administrators, and so on.

But where should I (as super-admin) install all these options? Not in the settings.php I guess?

lekei’s picture

If I understand you right, the most recent version of my installer (see: http://drupal.org/node/33581#comment-71335) might help.

If you install your first site then set-up the initial settings the way you want them to be for new sites, you can export the resulting database (usually only the system and variable tables) to a file called options.mysql using phpMyAdmin.

If you want a "Super Admin" then create an administrator role in your default setup, and save the users and users_roles tables. This will make you the admin (user 1) for any new site and you will then assign someone to have the Administrator role.

Edit the table to globally remove the table prefixes and remove any settings you don't want as defaults.

Save (or upload) the file to the /sites/default folder (replace the example options.mysql file). When you access a new domain, it will prompt you to run the installer, which will initialize the database with the default values.

ArunK’s picture

Ok, I still don't know what I'm doing wrong, its probably something really silly.

Can someone upload a sample settings.php file from version 4.6.5 for a multi site install? Here is the setup I'm trying to do: Main website (This site will have links to each of the sub sites).
www.mydomain.com
Sub sites
www.mydomain.com/demo1
www.mydomain.com/demo2 etc.

This setup is mainly for a test site for new modules/themes/ and layouts where I will be testing things before using them for some real websites I have in the works.

Each folder has a copy of a different settings.php file, with different db names.
sites/default/settings.php
sites/demo1/settings.php
sites/demo2/settings.php

Would installing modules work more or less the same way as if it was a single site install? Can all the themes be in the main themes folder and be shared between the different websites? I've installed Drupal several times before without any major problems, this is the first time I'm trying to do a multi site installation. Thanks in advance for the help!

jbrauer’s picture

From a look at settings.php's information it looks like you'd need:

sites/default/settings.php (will handle mydomain.com)
sites/www.mydomain.com.demo1/settings.php (the /demo1 site)
sites/www.mydomain.com.demo2/settings.php (the demo2 site)

I haven't tried this particular setup before so I don't know if you'll run into any problems with .htaccess rewrite rules if you're trying to use clean URLs. If possible it might be cleaner to do demo1.mydomain.com.

--------------------------
Adding Understanding

--

liquidcms’s picture

i think this is the same issue i have been trying to solve.. i have posted elsewhere with no success.

i have the following sites:

site1.mydomain.com
site2.mydomain.com
www.mydomain.com/site3

all off same multisite, different dbs, with site folders as:

sites/site1.mydomain.com
sites/site2.mydomain.com
sites/mydomain.com.site3 - this one was odd but this was needed to work

my only problem now is i can only seem to get site1 and 2 to use clean urls

if anyone know how to get site3 to ALSO use clean urls - would really love to hear it.

thanks,
peter....

styro’s picture

but I can probably help with the diagnosis...

Your first two sites are domain name based sites, but your third is a directory based one. Multisite in my experience works best with domain only based sites.

Because all three are sharing the same .htaccess file, they are all sharing the same RewriteBase setting. This works fine with the first two, because the correct RewriteBase is the default eg "/", but the third site needs a RewriteBase of "/site3".

What you'll need to do figure out is a way of applying a special RewriteBase setting to your site3.

I have no idea for sure, but I suspect it will either take some fancier conditional Apache config or a more complex file layout using a second .htaccess file and a lot of symlinks for everything else.

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal

Jacob Lee Anawalt’s picture

I like the multi-site feature for being able to manage one install of the Drupal software on a system. I followed the directions in the INSTALL.txt file section 4 (online at http://drupal.org/node/260) and by searching around the drupal.org site.

I chose to install the software into /usr/local/share/drupal-x.x.x with a symlink to the latest version at /usr/local/share/drupal.

I am hoping that this setup will help with Drupal upgrades. My upgrade plan is to just extract the latest Drupal into /usr/local/share/drupal-x.x.x.x and then copy or re-create the new per-site settings into the new code.

I tested this setup by upgrading a site one version at a time from a much older version. With each upgrade I changed the server's document root to the next version, reload the web server and if necessary ran update.php. It worked very well.

In the future, if I feel comfortable with an upgrade, I can then just delete and recreate my symlink pointing to the newer version and have all the drupal sites which are using /usr/local/share/drupal as their document root change at once to the new code base.

I'm still unsure about some things like how to handle public file downloads (directly via http, not managed through php) and having non-drupal directories in the site.

Hopefully more documentation on the multi-site feature will evolve from these discussions.

blicero’s picture

Hi everybody.

I would like to use drupal to do a multiuser blog system, something akin to blogspot or eblogger.

I am trying to find out what the best course of action is: should i make a multi-site installation on a single database (but does the database grow TOOOOOO big at one point [we are guessing around some hundreds bloggers]) or a multi-site installation with multiple database (but how can I keep control of what features a user can enable or disable or change something over all the installations at once?

thanks for any suggestion.

Scott Halliday’s picture

I too would like to use drupal to do a multiuser blogger system as well. Have you made any progress with this or wondering if anyone can offer any help and/or suggestions on how best to proceed.

mgerra’s picture

I've just selected Drupal for a multi-site CMS / Blogging / Wiki development. Have yet to install across multiple sites, which are LAMP, Shared hosting. Looks like Drupal has every feature that we'll need and more. Great app!

I'd like to set up a new Drupal subdomain / directory on-the-fly, each time a new user registers, ie. userfoo.mysite.com, userbar.mysite.com, etc, or mysite.com/userfoo, mysite.com/userbar.

Importantly, I'd like to do this automatically, and based on a users name, for instance.

I'm not an experienced engineer -- just know enough to be dangerous! Any advice from someone who may have already solved this would be much appreciated. I'm hoping this is something I can do as opposed to my hosting company. Many thanks.

robertDouglass’s picture

What you can do is make a DNS wildcard that routes all subdomains to your main domain. Then if you only have the domain.com folder in sites, it will get matched to handle them all:

so if you have

drupaldir/sites/
--domain.com/
----settings.php

settings.php will be called no matter if it is ted.domain.com or sally.domain.com or bob.domain.com.

Then you need to find the code somewhere on this site that you can use to set the $base_url in settings.php to the actual URL that was used to access the site. So if someone comes to the site with http://freddie.domain.com, the base URL will also be http://freddie.domain.com.

You could then put "freddie" in a global variable and use it to do things like set the theme (to freddie's individualized theme).

This opens up a world of cool possibilities. For example you could find a way to control access rights to all content so that people accessing www.domain.com see everything, like a normal portal, but people accessing john.domain.com can only see john's works.

Next thing you're going to say is "That's great, that's exactly what I want, how do I do it?" Well, I've not actually done that, so you'll have to fill in the blanks yourself. I just know that this is easier to do with Drupal than any other system I know.

- Robert Douglass

-----
My Drupal book: Building Online Communities with Drupal, phpBB and WordPress

TurtleX’s picture

Where does the symbolic link info get stored?

I know you can edit Virtual Hosts in Apache's httpd.conf file and all the info is stored in there, but when you make a symbolic link where does that info go, what file is it written to?

How do I remove a symoblic link?

styro’s picture

Are filesystem features. They don't live in a file, rather the filesystem itself.

Apart from the path, there is no info involved - they are just a pointer to somewhere else.

Deleteing a symbolic link is done the same way you delete a file or directory. That's the whole point of them - they behave just like a file or directory without actually being one. It's like you've make a copy of the file or directory, but it only takes up the space of one and changes to one are reflected in both.

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal

federico’s picture

I have read every post and I understand everything and done it. But I still do not get it to work.
Simplest case:
Create folder sites/subfoder
Copy settings.php to sites/subfolder
Go to www.domain.com/subfolder
I get a “not found”. I think I should get the same content as main site. What am I doing wrong?

Federico
http://www.zonaeconomica.com

PD: I have tried also creating a new database and changing
$db_url = 'mysql://username:password@localhost/databasename';
and also changing $base_url = 'http://www.domain.com’ to $base_url = 'http://www.domain.com/subfolder’ and it still doesn`t work.

styro’s picture

You need to configure your webserver to serve the www.domain.com/subfolder url from your main Drupal directory. Drupal runs through index.php for (practically) all its functionality - all your multisite urls therefore need to be sent to the Drupal index.php file by the webserver.

For multihosts in subdirectories this can be done with an Alias directive in Apache or using symbolic links in the filesystem, and for multihosts in subdomains you use Apache virtual hosting. Either way, you need to configure your webserver properly.

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal

federico’s picture

I've done it. At least with another domain. I have to try with a subdomain and a subfolder now. And still do not get clean url working but trying.
Any advice?
Thanks again styro

styro’s picture

require your .htaccess file to be used. That won't happen by default on Apache unless you use the AllowOverride all directive for that directory.

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal

federico’s picture

Thanks for the advice.

I have tried for hours and I didn't get it to work.
Searching in forums, I have found following two solutions for enabling clean urls in a multisite environment. Both indicated lines addition in .htaccess file:

-Option 1

<Directory "/www/username/public_html/sites/site2.com">
        AllowOverride all
</Directory>

-Option 2

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /

  RewriteRule ^site2.com/(.*)$ main/$1 [L,QSA]
</IfModule>

Option 1 gives me an internal server error in both sites (I tried also with other folder paths), and option 2 has no effect in either site. I’ll appreciate further help. Thanks in advance.

---------------------------
Federico
http://www.zonaeconomica.com

styro’s picture

You can't put AllowOverride or Directory directives in your .htaccess - they have to go in the main httpd.conf file. AllowOverrides purpose is to allow .htaccess files to override stuff - there is no reason for it to be in an .htaccess file. And the Directory directive applies the enclosed configuration to a directory - which would be redundant in a .htaccess file as it only applies to the directory it is in anyway. If you are hosted and don't have access to the servers httpd.conf, you will need to ask your host to enable .htaccess files for your drupal directory.

We use a virtual host based multi site setup with clean urls - we don't need to play with any .htaccess files or rewriting rules. It just works - once AllowOverride is enabled for those virtual host root directories.

You haven't said whether or not clean urls works with your main site. You should try to get that working before complicating things with multisite. And before you start complicating thing further by changing the rewriting rules, make sure the .htaccess is being used at all.

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal

federico’s picture

Thanks styro,
I updated to 4.7 and it Works fine without any other modification.
Know I want to do is to have a subdomain for each group sharing the same table. This approach is different from groups.drupal.org where each group has a “subfolder” but not a subdomain.
I know I can create a separate database and settings.php for each group, but I do not want to do than because it is too much administrative burden (creting tables, updating, etc.) and I neither want to create table aliases for each group because that is too difficult for me, I am a “citizen” user, a very newbie.
I did following:
1- I parked group1.domainb.com at domaina with basecode
2- I created folder sites/group.domainb.com with settings.php at domaina
3- ¿? Maybe changing something in settings.php? Changing base url is not the solution I guess

I go to group1. domainb.com and I see the same as group2. domainb.com , but I want that when I go to group1.domainb.com I see the same as domainb.com/group1 and when I go to group2.domainb.com I see domainb.com/group2.

I’ll appreciate further help

Thanks again styro
----
Federico
http://www.gruposactivos.com.ar

liquidcms’s picture

I think i am close to getting this.. but not quite.

first some background:

- i have numerous multisites set up but all are off subdomains - pretty easy to setup; BUT, i am trying to sort out how to setup to run off a subfolder (like federico is trying to do here)

I would like to be able to see my 2nd site (multi) at this URL: www.mydomain.com/multi

what i have so far:

main site folder: /inetpub/websites/main

sites folders:
default (for main)
www.mydomain.com.multi (for 2nd site)

info in www.mydomain.com.multi/settings.php
- point to new db
- leave base_url commented out (new in 4.7.3 - but also set it to http://www.mydomain.com/multi and no difference)

in Apache:

#		
<VirtualHost *>
	ServerName www.mydomain.com
	DocumentRoot "/inetpub/websites/main"
</VirtualHost>

alias /multi /inetpub/websites/main

RESULTS:

very close - i can now access my site - but the internal paths generated by Drupal seem incorrect and as a result i have no CSS loaded and the links are incorrect.

example HTML is:

<style type="text/css" media="all">@import "/multi/misc/drupal.css";</style>
</head>
<body style="background-color: #fff; color: #000;">
<strong>Create your administrator account</strong>
To begin, <a href="/multi/user/register">create the first account</a>. This account will have full administration rights and will allow you to configure your website.

so it would seem (since i can get to the correct install) that apache is doing the right thing - but i think drupal adds the /multi to all the links and this can't work as is - clicking a link has it going to main site and trying to load the page multi (which isnt a page) so i get "page not found" but at main and not at multi

I have clean URLs enabled - not sure if that makes a difference.

Can anyone see what is missing here?

Peter Lindstrom
www.LiquidCMS.ca

liquidcms’s picture

I think that i require modifications to to the bootstrap.inc and .htaccess files to complete the subfolder issue.

the post at: http://drupal.org/node/37177 explains this.

i think it is also possible to use a link (junction point in windows) as opposed to the apache alias - but i am using an alias.

Peter Lindstrom
www.LiquidCMS.ca

cogdog’s picture

I'm trying hard to wade through all of the suggestions and experiences here. My situation ins a bit different, as I am working on a new Drupal communit site that will replace some, but not all of an organization's legacy static HTML site. The old stuff will need to stay where it's at in terms of preserving old URLs; and the goal is to do all content from now going foward a la Drupal.

We will need some general front piece content areas about the organization, and then ways to create a series of sub-sites for our major projects, along with a members area where they will have log-in access to create new content (with flexinode) and and feeds to some aggregators. Other areas will need online registration forms for events.

It will not need to have our sites domain-ed; in fact, our leader prefers to have a structure of http://www.site.org/project1, http://www.site.org/project2, etc. I am not even sure if we need to multi-site this at all.

I am hopiing to develop the site over time, with current user input, by putting the beta site as its own subdirectory, so building out the content at http://www.site.org/beta/ and when ready, moving that to become the new main web site.

What I am not sure of now is how our eventually top level Drupal powered site will interact with existing static web content. I can likely avoid any Drupal naming convention that will overlap, so if I have a statiic old site at http://www.site.org/oldproject/about.html can that live along side my new Drupal content without interference? Or will my new stuff always need to be in some subdirectory, so our new content is always something like http://www.sote.org/a/........ ?

thanks for any help up the learning cliff (I have plently of code experience in PHP, mySQL, and other content systems, but brand new to Drupal)

/* ********************************************
Alan Levine: A Cog, a Dog, A Blog
Go Dog Go! http://cogdogblog.com
******************************************** */

annabug’s picture

Alright. I have read through nearly all if not all of the above. I have the following:

1. mainsite.com and mainsite.com/CT working from the same database but with seperate tables and seperate table prefixes.

2. As said above, I went through and set up a 2nd set of tables with a CT_ prefix. That all worked well. Things look good in the database.

3. in my /sites/ I have /sites/default and /sites/default.CT . Each has their own seperate settings.php file and all that looks good.

4. I realize I must probably do symbolic links to get the mainsite.com/CT to come up at all as a seperate site. I do not believe I have access to the Apache on my shared server. In fact, I'm pretty darn sure I don't. But I do have SSH access.

So, can someone please walk me through slowly what to type so that I have a seperate setup for mainsite.com (which is looking lovely, IMHO) and mainsite.com/CT ? I need to have the CT site come up seperate, be able to customize it, etc. I have done the database work. This is the last step for me. I am willing to provide any other info necessary.

Thank you.

-- Anna

martin_halford’s picture

I had a Drupal installation working at proj.co.uk/ and wanted to add a number of 'child' sites at test.proj.co.uk demo.proj.co.uk etc.

For a time I struggled with this, getting a blank page on the subdomains. Here's how I sorted it out:

In the Ensim Control Panel, created a subdomain demo.proj.co.uk with base directory var/www/demo (similar presumably with other control panels?)

From the shell, removed the directory demo (cd to www then rmdir demo)

Then added a symbolic link to the base directory of the main site (ln -s html/ demo)

In var/www/html/sites create a new directory called demo.proj.co.uk and copied the default settings.php file into this directory

The only changes I made to settings.php were the database name, username and password and setting the base directory to http://www.demo.proj.co.uk

I created files_demo and files_demo/tmp directories for 'private' file uploads outside of the public html directory, i.e. var/www/files_demo and var/www/files_demo/tmp. I had to chmod these to 777 to get them to work which is OK for us as we have sole control over the server, but I need to look into this further.

It then worked. I'm using separate databases and files directories for each subdomain.

I hope this helps someone - it was my lack of understanding of the symbolic link to the main site base directory that defeated me initially.

It doesn't work if you create a symbolic link in demo called index.php to index.php in the main site base directory!

Regards, Martin

[Edited 19 September 2006 correcting base directory and adding information on files directories]

ontoligent’s picture

This helped me. You explained it step-by-step, with any extra stuff.

jantichy’s picture

A drupal multi-domain module at last! -- http://drupal.org/node/104335