hello,

i'm a little lost. i've done a bit of searching but maybe from what i've read i'm just not getting it (which is most likely the case). i'm sure this is possible. i've setup a main site which is currently installed into the root directory, and would like to be able to run completely different sites off sub-domains (different database, different themes, etc...). is there a dummy proof step by step guide i can use?

here's my setup which i have complete control over:

drupal 6.2
ubuntu 8.04, Kernel 2.4.26
Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.1 with Suhosin-Patch
PHP 5.2.4-2ubuntu5.1
MySQL 5.0.51a

thanks for your bandwidth,

ephman

Comments

davemybes’s picture

For each subdomain, create a folder in /sites matching exactly the subdomain name. Create an empty database for each subdomain (or you can use table prefixes and keep everything in one database). Copy a clean settings.php into each folder, and then type that subdomain into your web browser. You will now see the Drupal install page. Configure as you like.

So now you will have all sites running on one Drupal install, with access to all themes and modules placed in the sites/all/themes and sites/all/modules folders. To have something available to only one of the subdomains, create a modules or themes folder in that subdomains sites folder, and put the stuff in there.

That should do it.
______________________________________________________________________________________________________
mybesinformatik.com - Drupal website development

______________________________________________________________________________________________________

ephman’s picture

thank you. ok so i followed your instructions. simple enough. i made an empty database then i created the sub-domain in my server, no problems. i then created a folder for the sub-domain in the sites directory and copied the settings.php into the folder. when type the sub-domain into my browser i just get the index of the directory with the settings.php file listed, there is no install page. when i click on the settings.php all i get is a blank page. what do you mean by "clean settings.php"? i simply copied my settings.php file from the default directory. i have not 'touched' that file, so i assume it's clean. any suggestions?

thanks,

ephman

davemybes’s picture

You need to use the settings.php file from the Drupal tar file. The one in the default folder has been modified by Drupal to point to that site's database. The one from the Drupal tar file is "clean". That should work then.
______________________________________________________________________________________________________
mybesinformatik.com - Drupal website development

______________________________________________________________________________________________________

ephman’s picture

thank you.

i tried that, assuming that's what clean mean (thanks for confirming). the file in the tar is actually named default.settings.php. still only listed the index, and then i tried to change the file name to just settings.php, and yet again still same issue. just to be clear, the file is located in drupal-6.2/sites/default? i looked at the permissions, and seem to be fine with root. and still have the same issue of only showing the index of the directory. tried other .php related pages, and things seemed to be fine.

thanks for your help,

ephraim.

rpatros’s picture

Once you go to the subdomain, add install.php at the end to start the installation:

example

http//localhost/test/install.php

Make sure that the setting.php file is pointing to the new database. Hope this helps.

ephman’s picture

i changed the settings.php file to point to the new database. when i tried your method of using the install.php file, http://subdomain.domain/install.php i get an internal server error 500, which i guess is good because it's proving i setup the subdomain properly at least. but alas, no avail. i've gone through these instructions suggested a few times, and i believe i'm following them properly. i just don't understand where i could be going wrong???

any other suggestions?

thanks,

ephman

davemybes’s picture

Very odd. Have you tried using default.settings.php (not settings.php) and then doing the install.php thing?
______________________________________________________________________________________________________
mybesinformatik.com - Drupal website development

______________________________________________________________________________________________________

ephman’s picture

yep. i've just banged my head over this.

thanks,

ephraim.

gervin’s picture

I followed the instructions and got the same results as you, ephman.

What files are in the subdomain?

gervin’s picture

Maybe this technique does not work for Drupal 6.x

ephman’s picture

on separate occasions i tried two different files only in the subdomain directory. first the settings.php file from the default directory. however i pointed the code to my new subdomain database. when that didn't work i decompressed drupal6.2 and took the default.settings.php file, and again pointed the file to the new subdomain database.

any clues? kind of glad to hear i'm not the only person with this issue, but still would love a solution. any help would be so appreciated!

thanks,

ephraim.

gervin’s picture

I am speaking of the true subdomain directory and not the one under the drupal/sites directory. I have been busy, but plan to work on this some more. I have a little bit of an unusual setup in that the test domain that I am using has a website which uses PHP and uses phantom HTMl files. In the .htaccess file I transfer initial control to the drupal configuration and can access the PHP website and another PHP website in a separate subdomain via the drupal. I am only looking to use the drupal to create a possible front end for existing websites and to try to learn drupal. When I resolve this, I will let you know.

ephman’s picture

i have nothing in the true subdomain. i was only using a directory within the drupal sites directory. any help would be really great thanks!

ephman.

gervin’s picture

I believe the problem with the multisite setup is that I am running on shared hosting. To use Drupal, I have to have it as a directory under a domain. This being the case, I believe that this setup could not possibly work for multiple domains. In the case of subdomains, it might work, but I have not been able to determine how to setup my .htaccess file to use only one install of drupal. Since I am only wanting to test this, I am opting to install drupal as a directory under the subdomain also.

davemybes’s picture

I have just gone through the steps of creating a multi-site setup in Drupal6, and it seems to be a little different than in Drupal5. Here are the exact steps I followed:

  1. create the subdomain folder in /sites e.g. /sites/sub.drupal6
  2. copy the settings.php from the /sites/default folder into the new folder
  3. remove the read-only attribute of the file
  4. edit the file to use the desired username, password and database
  5. in your web browser, enter your subdomain address and add /install.php to it e.g. http://sub.drupal6/install.php
  6. you should see the normal Drupal6 install page (note: you won't see any options for setting up the database, as its been done already)
  7. you should now see your new subdomain website

This has to work for you now. The only thing you have to be sure of is that the subdomain is pointing to your Drupal6 installation folder. In my case, I edited the Virtualhost setting for my main Drupal6 installation, and added sub.drupal6 as a ServerAlias. This is on my local test server, so I need to do all this manually. If you are on a shared hosting environment, use whatever control panel you have to point the subdomain to the same place as the main domain.

______________________________________________________________________________________________________
mybesinformatik.com - Drupal website development

______________________________________________________________________________________________________

ephman’s picture

i actually tried your method to the t a few days ago. great minds think alike. but when i go to http://subdomain.localhost/install.php i get an internal server error 500. now i know 100% my subdomain works fine. i can put whatever other html files in there and they render totally fine. now i don't have a special drupal site. sorry for this basic question but what do you mean by "I edited the Virtualhost setting for my main Drupal6 installation, and added sub.drupal6 as a ServerAlias." doesn't one already do that when they setup a subdomain?. i actually have full control over my server.

thanks,

ephraim.

davemybes’s picture

It kind of depends on how you setup the subdomain. If you use a control panel system like Plesk, Cpanel or Vdeck, then everything should be done for you and you shouldn't need to edit the Apache httpd.conf file (where the Virtualhost settings should be).

That error 500 implies that your site is there, but there's some config problem. This page, http://drupal.org/node/412, has some tips on fixing that. Could also be your php memory limit too (http://drupal.org/node/224106 and http://drupal.org/node/29268).
______________________________________________________________________________________________________
mybesinformatik.com - Drupal website development

______________________________________________________________________________________________________

ephman’s picture

ok i'm going to go through your suggestions. i doubt it's the php memory i've set it up there pretty high. i'm heading away for the weekend, so on monday when i get back i'm going to try some of these suggestions out. i really appreciate your help.

thanks,
ephman.

ephman’s picture

i setup the subdomain with webmin. and my subdomain settings are fine, i can put whatever i want in there and it works...

tried upping the php memory limits... no dice. as well as the htaccess file suggestion, didn't help either.

i upgraded to drupal 6.3, everything went smoothly, simple as pie. but still having the subdomain.localhost problem... looks like i'm getting ready to give up.

thanks,

ephman

davemybes’s picture

Sorry to say, but I'm out of ideas. If this server is web accessible I could take a look at it if you want. If its only locally accessible, you could load some remote access software (http://logmein.com for example), if you want me to take a look at it.

______________________________________________________________________________________________________
mybesinformatik.com - Drupal website development

______________________________________________________________________________________________________

ephman’s picture

thank you anyways i really appreciate it. your help was great! good karma back at ya.

thanks,

ephman

Flying Drupalist’s picture

Instructions are missing an important step. You have to park your subdomains at the parent domain location.
There's a few ways to do this, and they're all detailed here:

http://drupal.org/node/43816

Keith Hurst’s picture

Hi,

I have been through all the standard steps to try and get multi site / subdomain up and running.

Created a new folder off sites names mysubdomain.mysite.com

Copied in untouched settings.php.

Editited settings.php to point to newly created database.

when I go to http://mysubdomain.mysite.com/install.php I get the following error... ( amongst others )

Table 'db_1234567890.access' doesn't exist query: SELECT 1 FROM access

There are others following this but solve this and I think the whole picture falls into place.

Now the db_1234567890 is definitely the name of my database so it's picking up settings.php correctly, but I thought the part of the purpose of install.php was to actually create the tables Drupal needs?

Any help appreciated.

Thanks,
Keith

kduryee’s picture

Well, it's almost a year after the last post, and two years after the last from the OP, but I just solved this problem for my own subdomain and thought I'd post here in case others may need the info.

First, the environment:

I have a running Drupal install at the web root of a hosted website, eg. "www.mydomain.com" is on the Drupal root, mysite/public_html

Need to do:

Set up a subdomain, eg. "subsite.mydomain.com" using the Drupal installation described above.

Steps taken:

1. Created new MySql database for subdomain.

2. Created new folder in Drupal install for subdomain: "public_html/sites/subsite.mydomain.com"

3. Copied "default.settings.php" into above folder, changed name to "settings.php" and changed database connection information, (right around line 92), to point to new database,

 $db_url = 'mysqli://myprefix_username:password@localhost/myprefix_dbname';
$db_prefix = ''; 

4. Created subdomain using Cpanel. During creation of the subdomain, you are given a field to define the document root of the subdomain. By default it is populated with the new folder's root, eg. "mysite/public_html/subdomain". You are able to define an alternate path, however: DEFINE THE DOCUMENT ROOT FOR THE DRUPAL INSTALL. In my case the necessary document root was "public_html/" This lets Drupal configure the directory in "public_html/sites" to act as the subdomain. This was the step that was left off all the other instruction posts, or at least it was the one that didn't sink in on my part.

5. Try opening your new subdomain in a web browser by using just its address, eg. "http://subsite.mydomain.com". If the install process doesn't work and you get the access errors, point the browser to "http://subsite.mydomain.com/install.php". This should run your site's install program for your new subdomain, and viola! Your subdomain is Drupalized :-)

I hope this helps other users facing the same problem - I beat my head against this for far too long.

Zig’s picture

Hi all..

I had this problem and it wasn't until I read DEFINE THE DOCUMENT ROOT FOR THE DRUPAL INSTALL. in bold caps did I get it....

For those of you that got this far and are still stuck, the document root for multisite is the home directory of your first site install, ...

ie public_html/
NOT
public_html/sites/mysubsite

It will install like any other Drupal install assuming that you have the default.settings.php copied and renamed to settings.php in your subdomain directory

ie public_html/sites/mysubsite

good luck.

vintageb’s picture

If I create subdomains this way, will I be able to customize the theme for each subdomain and the content inside?

tutumlum’s picture

yes you can. just create new directories as modules and themes in your sub domain folder. the ones in sites/all folder will be used for all sites, the one in specific sub domain will be used just for it.

stardemos’s picture

i 've take every step... but it really does not work for me...
no istall screen, just get the 500 internal error...

Nora McDougall’s picture

Base install is Drupal 7.19

Need members subdomain

Symlink points members to www where the Drupal install exists

sites/members.domain.com exists

settings.php goes to empty database
- Interesting note, if a clone database is set up, the install.php says that Drupal is already installed.
- If the database is empty install.php goes to the Profile list - Standard or Minimal

Clicking Save and Continue goes to URL not found. It does try to redirect to the main domain name, but then fails.