Multisite with drupal for dummies

Running multiple sites off a single drupal codebase was my dream ever since I started experimenting with drupal six months ago. Despite the excellent features of drupal, most of its features are unfortunately confined to a choice group of geeks, as the documentation is best understood by the seasoned veterans.

The drupal install.txt about multisite is no exception. It misses out several steps thinking it as second nature for every user. However, the forums, though sometimes confusing, are of great help, and with the help of the forum topics and a few external resources, I managed to have my two sites and two subdomains up and running.

My environment

- shared hosting with cPanel, fantastico, NO shell access (and the host refused to create symlinks!).
- I was already running a fully-functional drupal installation at the location http://domainname1.tld. I had a few modules and themes in the "default" folder.

My knowledge

- not much knowledge with scripting, PHP etc.

What follows are the comprehensive list of steps I followed, and right, wrong, or different, it works! I will spare you the fine details, as I assume you are used to computers for a while..

Multisites with an additional parked domain

  • Using PHP MySQL or any other database application, create a database by the name "domain2"
  • Grant full privileges to the database to the default user
  • Using phpMyAdmin, create the tables and default data in your database by suitably modifying the drupal database file ("database.sql").
  • Using cPanel or ftp, create a sub-directory in the "/sites" directory called "domain2.com"
  • Copy the /sites/default/settings.php to the new directory /sites/domain2.com/settings.php
  • Make changes to the following line in the new settings.php file
    $db_url = 'mysql://db-username:db-password@localhost/new-db-name';
  • Create a symlink from the new location to the main site, using the command (for example):
    ln -s /home/username/public_html/
    /home/username/public_html/domainname2

    Here, I am assuming your webhost has parked your new domain at "/domainname2" folder of your main account. In this example, the url http://domainname2.tld should resolve to the physical folder /home/username/public_html/domainname2 on your server (or shared server).

If you don't have shell access and your webhost does not support creating symlinks, try out the symlink() function in php. Here is a step by step guide to using symlink function if you dont have shell access. Note that for this to work, it is necessary to delete the physical folder "/home/username/public_html/domainname2" from your web server, as the link created by symlink() is only symbolic and not actual. The article explains that in detail.

  • Now access your new domain name at the address http://domainname.tld
  • Create your first user account, which should be the admin user.
  • Multisites with a subdomain

    This is very similar to the above, but I am repeating the steps just to be sure..

    • Using PHP MySQL or any other database application, create a database by the name "subdomain"
    • Grant full privileges to the database to the default user
    • Using phpMyAdmin, create the tables and default data in your database by suitably modifying the drupal database file ("database.sql").
    • Using cPanel or ftp, create a sub-directory in the "/sites" directory called "subdomain.domainname.tld"
    • Copy the /sites/default/settings.php to the new directory /sites/domain2.com/settings.php
    • Make changes to the following line in the new settings.php file
      $db_url = 'mysql://db-username:db-password@localhost/new-db-name';
    • Create a symlink from the new location to the main site, using the command (for example):
      ln -s /home/username/public_html/
      /home/username/public_html/subdomain

      Here, I am assuming your webhost has redirected your subdomain to your "/subdomain" folder of your main account. In this example, the url http://subdomain.domainname.tld should resolve to the physical folder /home/username/public_html/subdomain on your server (or shared server).

    If you don't have shell access and your webhost does not support creating symlinks, try out the symlink() function in php. Here is a step by step guide to using symlink function if you dont have shell access. Note that for this to work, it is necessary to delete the physical folder "/home/username/public_html/domainname2" from your web server, as the link created by symlink() is only symbolic and not actual. The article explains that in detail.

  • Now access your new subdomain name at the address http://subdomain.domainname.tld
  • Create your first user account, which should be the admin user!
  • The above procedure was tested with 4.6 and 4.7. I have no clue about 5.0 RC. Any ideas?

    I've experience to create

    astra - January 6, 2007 - 23:12

    I've experience to create multisites using this way. It's really simple and effective.

    BTW, for those added modules that expected to be shared by the multisites, where should the modules be placed if I don't like them together with the core modules?

    The modules can be placed

    cog.rusty - January 8, 2007 - 03:24

    The modules can be placed under the settings directory of each site (where the settings.php file is). Then they will be visible only by one site.

    That is:
    /sites/site1.tld/modules
    /sites/site1.tld/themes
    /sites/site2.tld/modules
    /sites/site2.tld/themes

    This is possible in both Drupal 4.7 and Drupal 5.
    Additionally, in Drupal 5 you can place your shared contributed modules and themes under /sites/all/modules and /sites/all/themes and they will be visible by all sites.

    Even more of a dummie here

    AstaChattare - January 7, 2007 - 21:10

    Symlinks is something new to me. What do you more exactly do with the symlink?

    A symlink (symbolic link) in

    cog.rusty - January 8, 2007 - 04:18

    A symlink (symbolic link) in unix-like systems is something similar to a Windows shortcut. It is a special file which lead to another specified file or directory.

    Notice the example above:

    ln -s /home/username/public_html /home/username/public_html/subdomain

    This creates a file called "subdomain" which takes the place of the deleted directory "subdomain". When you try to go there, you find yourself in "public_html" (where Drupal is installed).

    Windows shortcuts do not have exactly the same functionality, so there is a utility program called "junction" which behaves in the same way as symlinks.

    -------

    Someone here asked me what is the difference between a symlink and a Windows shortcut.

    Suppose we have a directory /home/aaa/bbb/ccc, and ccc contains some files.
    We are in /home, we create a symlink ddd leading to ccc, and then we go to ddd.

    ln -s aaa/bbb/ccc ddd
    cd ddd

    We look around and we see the files contained in ccc. So far so good. But where are we?
    - If it was a Windows shortcut we would be in /home/aaa/bbb/ccc. If we step back we go to bbb.
    - But with a symlink we are in /home/ddd. If we step back we go to /home.

    I'm probably stupid

    AstaChattare - January 8, 2007 - 18:15

    but I still don't get it. I now understand how it works. But what kind of a file do you create? Is the symlink the name of an empty file where the only important thing is the name of the file? And do you put it where the directory "subdomain" should have been?

    Thank's for taking time explaining to me by the way.

    Yes, it is something like an

    cog.rusty - January 8, 2007 - 18:31

    Yes, it is something like an empty file with two important properties: Its name and where it leads (or what it represents).

    And yes, you put it where the directory "subdomain" should have been (after deleting the directory if it was there).

    A bit more questions

    AstaChattare - January 8, 2007 - 21:07

    I believe I was a bit confused there. That command is to be done in the database isn't it?
    If I want to do a symlink in php instead, like in the link above, then I am supposed to do it in a .txt - file. But what should that file be called an where should it be put. The site in the link only gives me the content of the file, it doesn't say exactly what to do with it ( I tried to register on the site to ask the question there but it didn't work).
    Shortly;
    If i do the symlink in PHP what do I call the file?
    And when it says put the file in the root is root=directory where Drupalinstallation is placed?

    Not in the database. It is a

    cog.rusty - January 8, 2007 - 21:35

    Not in the database. It is a command which you type in a linux command console, if you have shell access to the server's file system. That small php script is an alternative way to do it, by making the web server enter the command for you.

    To tell you exactly what it should contain and where to upload it, I must know:
    - the directory path of your web root (where you go when you type www.example.com)
    - the directory path where you have uploaded Drupal (straight into the webroot directory, or in a /drupal subdirectory?)
    - the web path (or the subdomain) which you want to use for your second site

    Sorry for being a nuisance.

    AstaChattare - January 8, 2007 - 21:53

    Sorry for being a nuisance. I have a domain
    example.com
    There I have created subdomains.
    example1.com
    example2.com
    example3.com
    I have an original Drupal installation 4.6 in example.com and don't want to touch it right now.
    So I have installed Drupal 5.0 beta 2 in example1.com.
    Now I want to create a multisite where I can access example2.com and example3.com via my installation in example1.com. I understand the settings.php part but I do not understand the symlinks-part.

    Oh, so you have full domain

    cog.rusty - January 8, 2007 - 23:10

    Oh, so you have full domain names and not just subdomains.

    Then other solutions may be more suitable than symlinks. For example, not to create domain2 and domain3 but make them CNAMES (aliases) for domain1 so that all three use the same web root directory. If you can do this, then nothing else is needed. Drupal would take over and serve three sites.

    Anyway, here is what you would do with symlinks (if there is nothing in your host's setup to forbid it):
    - example1 uses the web root directory webroot1
    - example2 uses the web root directory webroot2
    - example3 uses the web root directory webroot3
    You want example2 and example3 to use also the webroot1 directory.

    Let's assume that they are three parallel directories under your main webroot directory (is it so?). If the three directories are parallel you can do the following.

    1. Create a text file containing:

    <?php
    symlink
    (".", "../webroot2");
    symlink(".", "../webroot3");
    print
    "Done";
    ?>

    These commands mean: Create a symlink pointing here (the single dot), place it one step back (the double dot) and name it webroot2 (or 3).

    2. Name this text file 'linkthem.php' or anything you want and upload it to the webroot1 directory.

    3. Step back one directory and delete or rename the webroot2 and webroot3 directories (using FTP), so that symlinks can take their place.

    4. Go one more step back using FTP, behind the parent directory of the three parallel directories, and make it "writable by all" for a minute (right click with your FTP program, set its permissions to 777). This is needed because otherwise your php script is not allowed to create files in there.

    5. Using your browser, go to http://example1.com/linkthem.php. Then the script will run. If it is successful you won't see any error messages but only "Done". Refresh the view of your FTP program to see if the webroot2 and webroot3 symlinks are in place.

    6, A little housekeeping: Put the parent directory's permissions back to 755 (or whatever it was) and delete or hide the "linkthem.php" file.

    The rest is up to Drupal.

    Thank you very much that was

    AstaChattare - January 10, 2007 - 17:28

    Thank you very much that was a very good explanation. Now it is up too me to try it! And yes they are parallel directories.
    I want to make a testsite before I start trying to do the real site
    Thank's again!

    Please answer another

    AstaChattare - January 10, 2007 - 20:57

    Please answer another question for me.
    How do I delete a symlink?
    I did something terribly wrong. I tried to create a symlink and now my whole domain is suddenly under the symlink. And I do not know how to undo it?? And without loosing my whole site?
    My symlink mirrors the whole site - and I now cannot delete the symlink because if I do so i delete the whole site.

    You can delete a symlink

    cog.rusty - January 10, 2007 - 21:47

    You can delete a symlink without fear, like any other file. The directory where it points will not be affected.

    Just make sure that you are deleting a symlink and not a real directory.

    If the server does not allow you to delete it with FTP (because it was created by a script and now it is owned by the webserver), then use a script again to delete it.

    If your directory structure was exactly like my example, you would create this text file to delete the symlinks:

    <?php
    unlink
    ("../webroot2");
    unlink("../webroot3");
    print
    "Done";
    ?>

    (If they are real directories these php statements will refuse to delete them anyway).

    You would name this "delthem.php", you would upload it to "webroot1", you would unprotect (777) the parent directory of the three parallel directories, and you would run the script by going to http://example1.com/delthem.php with your browser.

    It would have been easier if you gave your exact directory structure and "which is where"...

    Sorry

    AstaChattare - January 10, 2007 - 22:11

    I probably haven't enough skill to try these things. Just thought I'd be smart and rebuild my sites since I want to change them and at the samt time upgrade to 5.0 when my test worked out.
    I thought I explained it correctly but now I se I didn't. Just to show anyway. When I look in my FTP window it looks like this.

    12.23.345.456
    |
    |- mysite.org
    |
    |- blogs.mysite.org
    |
    |- food.mysite.org
    |
    |- food1.mysite.org
    |
    |- food3.mysite.org
    |
    |- food4.mysite.org

    Mysite.org is my domainname. Mysite.org and blogs.mysite.orgs are two running Drupalsites in 4.6.6.
    The four food.mysite.orgs is my testsites where I want to learn Drupal 5.0 and where I wanted to try multisites. But I'm starting to think this is more than I can cope. I think I've read almost everything about multisites here and the only thing I really get is that I'm supposed to create a folder in settings with a settings.php in. Everything else is mere gibberish to me. I just don't get it.

    As you said, you are

    cog.rusty - January 10, 2007 - 22:54

    As you said, you are supposed to create folders under /sites with the names of your sites, each containing a settings.php file for a site. This is how Drupal will know to choose and bring up the right site that the user asked.

    But to do this, Drupal first must be asked. This is why all user requests for different sites must go where Drupal is installed.

    I think that you almost made it work.

    You went to "http://food1.mysite.org" and you saw "mysite.org", ok?
    This means that the symlink worked, but you also needed under "mysite.org" a "/sites/food1.mysite.org/setings.php" file to make Drupal choose the correct sub-site, "food1".

    What I did was when I tried

    AstaChattare - January 10, 2007 - 23:18

    What I did was when I tried to create the symlink I forgot to write .org. I wrote food1.mysite. And in my FTP-window I suddenly have something that looks like a folder and is called food1.mysite. And in that folder the whole 12.23.345.456 and all the sites is mirrored.

    And the code I ran was

    <?php
    symlink
    (".", "../food1.mysite");
    print
    "Done";
    ?>

    And it looks like this

    12.23.345.456
    |
    |- mysite.org
    |
    |- blogs.mysite.org
    |
    |- food.mysite.org
    |
    |- food1.mysite- ---------| 12.23.345.456 etc
    |
    |- food1.mysite.org
    |
    |- food3.mysite.org
    |
    |- food4.mysite.org

    It is just a symlink. You

    cog.rusty - January 10, 2007 - 23:41

    It is just a symlink. You can delete it.

    But be careful where you upload the script, because this symlink shouldn't point to 12.23.345.456. It should only point to one site where you have Drupal installed. There must be another mistake.

    Let me repeat briefly what

    cog.rusty - January 10, 2007 - 23:36

    Let me repeat briefly what you need to do for these sub-sites.

    1. Create the database for food.mysite.org and install Drupal 5.

    2. Rename food1.mysite.org to old-food1.mysite.org to make space for the symlinks.
    Do the same with old-food2, old-food3 and old-food4.

    3. Create the symlinks with a script containing:

    <?php
    symlink
    (".", "../food1.mysite.org");
    symlink(".", "../food2.mysite.org");
    symlink(".", "../food3.mysite.org");
    symlink(".", "../food4.mysite.org");
    print
    "Done";
    ?>

    I won't repeat the details here... upload the script and run it in food.mysite.org to create the 4 symlinks for the 4 sites. Now, all sites will lead to to food.mysite.org (don't be surprised) and it is time to make Drupal choose between them:

    4. Under "food.mysite.org/sites" create the subdirectories:

    food.mysite.org/sites/food1.mysite.org
    food.mysite.org/sites/food2.mysite.org
    food.mysite.org/sites/food3.mysite.org
    food.mysite.org/sites/food4.mysite.org

    In each subdirectory, upload a fresh settings.php file.

    5. Now you are ready. When you go to one of these sites, for example, http://food1.mysite.org, Drupal will ask you for a database and prefix and will start a new installation.

    I'll try it again when I

    AstaChattare - January 11, 2007 - 16:18

    I'll try it again when I have the nerve :)
    I put the script in the root of food.mysite.org

    You are a really patient person.

    Something doesn't work. Now

    AstaChattare - January 11, 2007 - 21:13

    Something doesn't work. Now I have created and uncreated symlinks. But the symlinks do not point at food.mysite.org they still point at 12.34.56. etc. When I write the adress in the browser I se all my folders = my different domain-folders.

    This is a mystery to me

    cog.rusty - January 11, 2007 - 23:09

    This is a mystery to me too.

    I did some experiments with using symlinks across different domains and I found that FTP (Filezilla) gives strange results when I click on the symlink.

    However linux shell commands seemed to behave correctly with the symlink, so I went on and created the subdirectory under /sites anyway, then I went to the secondary site with the browser and everything worked.

    So, it is possible that only FTP has this problem with symlinks and you can ignore that puzzle and go straight to the real directory to set up all the sites.

    Cpanel and php for a symlink

    David Field - March 5, 2008 - 06:47

    I liked the code

    <?php
    symlink
    (".", "../webroot2");
    symlink(".", "../webroot3");
    print
    "Done";
    ?>

    which cog.rusty suggests

    I adapted the code to replace the ".." double dot in the code with a "." single dot. This then suited my directory structure which has my main site at top level in public_html (it's called www.stride4.net) and my addon sites in the lower down folder of public_html/sites
    Although ANhosting, my hosting providers, granted me shell access for creating symlinks, I found that it was easy enough just running the PHP code without going into shell access. I did not manage to set up multisites by just using Cpanel without using symlinks as suggested as being possible in some posts in this thread.

    One thing that caught me out is as follows:
    Say your new domain is called mynewsite.com. When you use Cpanel (using the addon domains menu) to create a folder for this new domain under public_html it will let you call it "mynewsite" but it will not let you call it "my newsite.com" This is not a problem though. You let Cpanel proceed to create the folder. You then delete the folder and create the symlink in it's place also calling it "mynewsite"
    However, remember when you create the drupal subdirectory under public_html/sites this time it IS called "mynewsite.com" with the ".com" extension. NB Also do not make the mistake of putting it in public_html/sites/all. And remember to finally run install.php as your last step.

    David Field

    Multisites by cPanel

    Imago - March 19, 2008 - 08:16

    "I did not manage to set up multisites by just using Cpanel without using symlinks as suggested as being possible in some posts in this thread"

    That's the esaiest way to set up a new site in the chain.

    If new domain - use the addon domain function (create foo.com in folder foo)
    If subdomain - add new subdomain (foo in folder foo)

    Then go ftp or ssh and delete the new folder /foo in the root and execute

    ln -s /home/account/public_html/ /home/account/public_html/foo

    and you are ready to install

    Multisites by cPanel

    David Field - March 29, 2008 - 01:01

    I think its one of those 'its easy when you know how things'
    The Linux directory structure is all new stuff to me.

    For the code ....
    ln -s /home/account/public_html/ /home/account/public_html/foo and the other similar example in this thread,
    I had assumed that the 'home' word has to be replaced with something else specific to my server directory structure. I now since realize you literally type 'home'. Simple.
    Thanks.

    Have gone thus far. But

    kding - April 29, 2008 - 19:49

    cog.rusty. I have been asking you questions these past 2-3 days. Thank you for your willingness to reply. Yesterday I followed your 6 steps in your "Oh, so you have full domain" (i like this subject line) because I was trying to install a multisite in a new domain I bought. I went through your six steps with no problem (I mean at least I did not see error messages). Now, your last line after the step #6 is "The rest is up to Drupal". In conjunction with other posts in this thread, I believe what you mean is similar to "browsing your second site and see what happens". Am I right?

    My main site is http://tech4he.org
    My 2nd site is http://tech4he.org/epi

    If you go to the second site you will see it is exactly the same as what you see at the main site. I tried to create new menu items and add new nodes at both sites but I saw the "same site" at both sites (of course, I think, because everything goes to the same database). So, does this mean something wrong in my 6-step installation? Or I did not do right at "The rest is up to drupal"?

    I feel I am making progress but not quite enough yet. Thanks again!

    You should be almost there

    cog.rusty - April 29, 2008 - 20:25

    You should be almost there. The first part was to make all your sites' URLs to lead where you have installed Drupal (either using symlinks or using your cpanel, or in another way, it doesn't matter).

    Now when you visit any of the sites, Drupal takes over. It examines the URL which the browser asked, and compares it with the names of the directories under /sites.
    - If it finds a matching directory name, it looks inside for a settings.php specifying the database of that site and brings up that site (or installs a new one if it didn't exist).
    - If it finds no matching directory name, it uses the /sites/default directory.

    So, suppose that you have your main site's settings.php file (which contains its database info) in /sites/defauls.
    - Create a new directory under /sites, and name it tech4he.org.epi (i.e. sites/tech4he.org.epi - notice the last dot).
    - Then visit http://tech4he.org/epi and the new directory will be used for the new site's settings.

    I did what you told:

    kding - April 29, 2008 - 22:21

    So, suppose that you have your main site's settings.php file (which contains its database info) in /sites/defauls.
    - Create a new directory under /sites, and name it tech4he.org.epi (i.e. sites/tech4he.org.epi - notice the last dot).
    - Then visit http://tech4he.org/epi and the new directory will be used for the new site's settings.

    When I browse through the main and second sites they look the same. Should I put anything under /sites/tech4he.org.epi? Thank you. I am getting excited.

    I had to go and try it myself

    cog.rusty - April 30, 2008 - 00:05

    I had to go and try it myself, because there has been a small change in Drupal 6.

    1. Copy sites/default.settings.php to sites/tech4he.org.epi/settings.php (copy and rename).
    2. Edit sites/tech4he.org.epi/settings.php, find the $db_url and $db_prefix lines, and comment them out by putting a # in front.
    3. Browse to http://tech4he.org/epi and the installation sript will start.

    Alternatively:
    2. Instead of commenting out the 2 lines, fill-in the correct values for the new site.
    3. Browse to http://tech4he.org/epi/install.php (in this case it is needed), and the installation script will proceed without asking you about the database.

    If you need to go back to fix something, note that after installation Drupal makes the settings.php file and the tech4he.org.epi directory write-protected (permissions 444 and 555 respectively), and you may need to chmod them to 644 and 755 to make any changes.

    Yes, I do have full domain

    kding - April 30, 2008 - 01:57

    I want to thank cos.rusty for being so patient with me and helpful in guiding me through my multisite installation process. From my own experience I am going to add more steps after cos.rusty's six steps in his wonderful post "Oh, so you have full domain". I use my own case as an example. (I have drupal 6.2 installed at my root, or tech4he.org. I want to have a second site at tech4he.org/epi, which is NOT a subdomain. After cos.rusty's 6...)

    7. use FTP to create a new directory: site/tech4he.org.epi (the new directory name is tech4he.org.epi).

    8. found the file at site/defualt/default.setting.php. Edit it by commenting out the two lines in the file just like this:

    #$db_url = 'mysql://username:password@localhost/databasename';
    #$db_prefix = '';

    9. do nothing else but change the file name from default.setting.php to setting.php

    10. upload the setting.php to site/tech4he.org.epi fold

    11. change setting.php's permission to 777

    12. Browse to http://tech4he.org/epi

    13. (dang dang dang da...) The page you see now is the installation script page asking you to enter database installation information.

    14. by this time I realized I need to set up a database first. So I went to my cpanel to creat a database.

    15. I went back to #13 to finish the database set up process. By the end It said to change setting.php permission back to 755.

    16. I did it, and then

    17. browse to http://tech4he.org/epi again. A new site was born.

    That is my initial experimentation. I still have a lot to test and to learn. But at least I have gone thus far. Thanks again.

    I used this following php to

    kding - April 30, 2008 - 02:03

    I used this following php to creat symlink the way cos.rusty's steps said:

    <?php
    symlink
    (".", "epi");
    print
    "Done";
    ?>

    When browsed tech4he.org/linkthem.php I saw nothing but "Done". Then I browsed tech4he.org/epi, and saw the same screen as I had at root url. I started the above step 7 from there.

    By the way,

    cog.rusty - April 30, 2008 - 02:52

    By the way, in #14, creating a new database was optional. You could have used the same database for convenience, with a different prefix for the tables, for example $db_prefix="epi_";

    node table
    user table
    ....
    epi_node table
    epi_user table
    ...
    etc

    prefix

    kding - April 30, 2008 - 11:02

    I figured it out later, and used prefix method. However, I don't know why prefix_ is better or worse than seperate database. How does this affect: speed, moving a drupal site, traffic count, etc.

    From what I have heard

    cog.rusty - April 30, 2008 - 13:57

    From what I have heard (can't judge), separate databases are generally better, except if (a) you don't have them or (b) you want to combine users/content/settings from different sites.

    How to combine settings,

    kding - April 30, 2008 - 18:14

    How to combine settings, themes, and modules? I have three sites with three different prefix in the same database.

    It is a very complicated

    cog.rusty - April 30, 2008 - 19:26

    It is a very complicated subject. Many people want to have the same users on all sites, and a few want to share some content as well. This is done by sharing some of the database tables between sites, but there are many pitfalls. See for example http://drupal.org/node/147828

    Yeah, I don't want to go

    kding - April 30, 2008 - 19:56

    Yeah, I don't want to go there.
    When I change something like permission, content types, etc. for one site, are these changes saved in database tables? If so, can I simply export a few of relevant tables from one site and import them into another site to make the same changes? (I guess separate database is better in this scenario).

    Everything is in the

    cog.rusty - April 30, 2008 - 21:18

    Everything is in the database, and there are modules for exporting-importing content, categories and some other things from tables. But this needs to be done carefully by a program using Drupal's API because, for example, a particular user may have a different ID in the databases of two sites, or two different pieces of content may happen to have the same numeric ID in the two databases... this kind of thing.

    The same pitfalls that I was talking about regarding shared tables.

    I will experiment a little

    kding - May 2, 2008 - 22:00

    I will experiment a little bit. sounds scary though.
    thank you!

    I want to create symlinks toward adding a subdomain.

    hbryan - April 12, 2007 - 21:57

    I understand what to type in place of "username" and "public_html" in my text file but what goes in place of "home"?

    ln -s /home/username/public_html /home/username/public_html/subdomain

    I guess for subdomain I should type "subdomain.domain.net"?

    Running 4.7.

    "subdomain" is the name of

    cog.rusty - April 13, 2007 - 00:43

    "subdomain" is the name of the real directory which the subdomain expected to find there (which normally would contain the subdomain's files).

    Instead of a directory, it will find a symlink with the same name, which will lead back to public_html.

    Thank you. I guess I did it

    hbryan - April 13, 2007 - 13:17

    Thank you. I guess I did it right but it wasn't actually what I needed. :(

    I wanted art.domain.net to resolve to domain.net/art but ended up with domain.net/art resolving to domain.net.

    Meanwhile I asked my host for advice and they assert that symlinks won't even do what I am looking for. (they're not very familiar with Drupal)

    Should the settings.php file in public_html/art/sites/all be the same as the one in sites/art.domain.net?

    You wrote:

    cog.rusty - April 13, 2007 - 19:11

    You wrote:

    I wanted art.domain.net to resolve to domain.net/art but ended up with domain.net/art resolving to domain.net.

    Right, but I don't understand what you are trying to do. Didn't art.domain.net already point to the domain.net/art directory? The only reason to do the above is if you want to use a Drupal installation which is in public.html and not in public.htm/art.

    If you have Drupal installed in /public_html/art and you have a subdomain which already maps there, then you don't need any symlinks. In that case, only one settings.php file in public_html/art/sites/art.domain.net is enough

    (and not even that is necessary -- if you have only one Drupal site, then public_html/art/sites/default would do the job as well).

    Or did I get your setup wrong?

    I have never on any try

    hbryan - April 13, 2007 - 21:05

    I have never on any try gotten art.domain.net to be anything but be a "page not found".

    I already have a site, domain.net. I need a second site, art.domain.net.

    Toward this end, I followed the instructions above, for multisite with a subdomain. After following the instructions I didn't get a new/second site on art.domain.net, I got domain.net duplicated/mirrored at domain.net/art.

    Those original instructions didn't specify the second Drupal install in the folder in public_html, I read that further down the page. I need the second site to look and feel different from the main site, for this reason I guessed that (maybe) this "second drupal instance" instruction applied to my circumstance.

    If you have Drupal installed in /public_html/art and you have a subdomain which already maps there, then you don't need any symlinks. In that case, only one settings.php file in public_html/art/sites/art.domain.net is enough

    The subdomain art.domain.net is not mapped anywhere. It has never worked.

    (Hmmm .. maybe I need to register the subdomain and have it parked where I need it???)

    If I'm not using a second instance of drupal, what the heck should display when the browser calls up art.domain.net? If it is supposed to just mirror the domain, then that totally defeats the purpose for me.

    What goes in that public_html/art if not a second instance of drupal?

    More questions... 1. When

    cog.rusty - April 13, 2007 - 21:41

    More questions...

    1. When you created your art.domain.net subdomain in your control panel, you were supposed to get a directory where you would put its files (usually, but not necessarily, public_html/art). If you didn't notice that directory, can you delete and then create again the subdomain and this time watch closely for that associated directory name?

    2. Is your existing site (at domain.net) a Drupal site? (I mean did you already have a Drupal installation in public_html or is that a different kind of site?) If a Drupal installation already exists, you will reuse it with a symlink. If not, you will just install Drupal in the subdomain's directory.

    1. I do not seem to have the

    hbryan - April 13, 2007 - 22:25

    1. I do not seem to have the ability through my host control panel to create a subdomain. I actually thought that creating the symlink was sort of the same as creating the subdomain .. :O

    I guess I would need to ask my host to do this (create the subdomain)?

    2. Our existing site is a drupal site.

    Are symlinks only needed for multisite with a single drupal instance?

    Or .. if my host creates my subdomain do I still need a symlink?

    Thank you for your patience CogRusty. You're obviously a saint. :)

    Heh, was I so obvious

    cog.rusty - April 13, 2007 - 22:51

    Heh, was I so obvious :)

    Subdomains and domains are Web things. Symlinks are just file system things, somehow similar to Windows shortcuts. Big difference.

    If you can't create a subdomain yourself using some kind of control panel, then do ask your host.

    - The most convenient would be a http://art.domain.net subdomain pointing to the same public_html directory, same as your main site. Then you would not need a symlink for your second site.

    - The most likely case is a http://art.domain.net subdomain pointing to a public_html/art directory. In that case you would do what you tried before -- delete the art directory and replace it with a symlink pointing back.

    - A third case, if you can't have a subdomain, is to just use an URL with a subdirectory, such as http://www.domain.com/art. Again you will need a symlink. There won't be a real "art" directory, just an "art" symlink pointing back.

    In all cases, the user will land into public_html, where Drupal will ask "What was the user's request? Was it www.domain.net or art.domain.net or what?" and then it will check the names of the directories under /public_html/sites to make the best match and present the right site.

    LIGHT BULB!

    hbryan - April 13, 2007 - 23:28

    Thank you!

    It's in my host's hands for now, I'll wait to hear back if we can get our subdomain.

    Cog.Rusty, I hope you're still around & still a practicing saint

    Peculiar_One - October 24, 2007 - 01:30

    Because I'm confused. I've been trying to follow the various instructions in this thread and elsewhere but haven't had any luck no matter what I do.

    If you have Drupal installed in /public_html/art and you have a subdomain which already maps there, then you don't need any symlinks. In that case, only one settings.php file in public_html/art/sites/art.domain.net is enough

    These are the steps I've taken:

      1. Fresh install of Drupal 5.1 in public_html
      2. Created new database and user will full privileges
      3. Via cPanel, created sub-directory in /sites/myhusbandssite.domainname.net
      4. Copied settings.php from sites/default to sites/myhusbandssite.domainname.net

    This is what I'd like to do: Use current Drupal install in domain root to run three subdomains--

      mysite.domainname.net
      myhusbandssite.domainname.net
      mydaughterssite.domainname.net

    --so that, for example, accessing the URL http://myhusbandssite.domainname.net directs to a Drupal instance on his site that can have whatever templates and modules he wants suitable to his needs for his site and ditto all that for my daughter and myself.

    What I'm confused about:

      1. Do these subdomains need created first via cPanel in addition to creating sub-directories of the same names in the sites directory or not?
      2. Do I need to implement symbolic links to achieve this?
      3. Am I understanding correctly that it is no longer necessary to alter the base_url and database data in the copied settings.php file?

    Thanks very much for any help.

    =-=

    VeryMisunderstood - October 24, 2007 - 01:37

    1. Do these subdomains need created first via cPanel in addition to creating sub-directories of the same names in the sites directory or not?

    so long as they are created doesn't matter whether they come first or last. With some hosts you can point the subdomain at the maindomain during the setup of the subdomain. Other hosts create the subdomain and automatically point to it, which you can then change in your host panel. The thing I see most people do incorrectly most often, is they point the subdomain to the sites/subdomain.maindomain.com folder. This is incorrect. teh subdomain should point to the same folder that Drupals index.php is located in.

    2. Do I need to implement symbolic links to achieve this?

    yes, the subdomain that is created needs to point to the main domain. When a user calls subdomain.maindomain.com Drupal will then search the sites folder for a match based on that subdomain.maindomain.com. If drupal finds a fresh settings.php, then drupal will attempt to install. if drupal finds a settings.php that already has a $db_url in it (inserted upon installation), Drupal will then run normally.

    3. Am I understanding correctly that it is no longer necessary to alter the base_url and database data in the copied settings.php file?

    Drupal expects one of 2 things. A fresh settings.php file without a $db_url for installation so that it can install the next site of the multisite or a $db_url that is already filled in and pointing to an active DB for the site to run.

    _____________________________________________________________________
    My posts & comments are usually dripping with sarcasm.
    If you ask nicely I'll give you a towel : )

    Thank You for the Quick Reply

    Peculiar_One - October 24, 2007 - 02:51

    ...With some hosts you can point the subdomain at the maindomain during the setup of the subdomain. Other hosts create the subdomain and automatically point to it, which you can then change in your host panel. The thing I see most people do incorrectly most often, is they point the subdomain to the sites/subdomain.maindomain.com folder. This is incorrect. teh subdomain should point to the same folder that Drupals index.php is located in.

    Just to clarify if I may...when you speak of the subdomain "pointing to" a location, are you speaking of achieving this using a symbolic link or using the subdomain redirection form in the subdomains section of cPanel?

    ... If drupal finds a fresh settings.php, then drupal will attempt to install. if drupal finds a settings.php that already has a $db_url in it (inserted upon installation), Drupal will then run normally.

    Drupal expects one of 2 things. A fresh settings.php file without a $db_url for installation so that it can install the next site of the multisite or a $db_url that is already filled in and pointing to an active DB for the site to run.

    Presently, if Drupal were to read the settings.php file I copied into sites/myhusbandssite.domainname.net the $db_url listed there is the database created during the original install, so that is incorrect and I need to change it to the database *I* created (ie, $db_url = 'mysql://domainname_husbandsdb:husbandsdb password@localhost/domainname_husbandsdb';), correct?

    The symbolic links thing I will have to look into a little more. I'm familiar with them by name and general function, but have never had the need to create any. I'm on a GNU/Linux box but I haven't done enough command line stuff to really know what I'm doing yet and I'm pretty sure I have shell access to my server but not quite sure how to go about all that either, so as I said, I will have to do some more reading.

    Thanks for helping get me going in the right direction though! Much appreciated. :)

    =-=

    VeryMisunderstood - October 24, 2007 - 02:57

    when you speak of the subdomain "pointing to" a location, are you speaking of achieving this using a symbolic link or using the subdomain redirection form in the subdomains section of cPanel?

    either method works. Essentially cPanel is creating the symbolic link for you and doing it through cPanel is fine. I don't do it through the command line I use my hosts panel. (not CPanel but same premise)

    Presently, if Drupal were to read the settings.php file I copied into sites/myhusbandssite.domainname.net the $db_url listed there is the database created during the original install, so that is incorrect

    yes that is incorrect. you want a brand-spanking-new settings.php from a fresh download or an archived download you have on your local machine.

    I need to change it to the database *I* created (ie, $db_url = 'mysql://domainname_husbandsdb:husbandsdb password@localhost/domainname_husbandsdb';), correct?

    nope, you want a fresh settings.php untouched by you, or by drupal. just like you had when you downloaded drupal orginally for the first site.

    by uploading a fresh settings.php drupal will find it and run install.php again. You will see the same screens you saw when you installed drupal the first time. you will enter your DB location DB username DB password and drupal will add it to settings.php as it orginally did. This time though you will enter the information for the 2nd DB (be it your husband or your daughter).

    If you are running all three websites off of the same DB you will have to expand the collapsed advanced settinsg menu during install and set a DB prefix. if you are using multiple DB's (one for each site) then you don't have to worry about prefixes.
    _____________________________________________________________________
    My posts & comments are usually dripping with sarcasm.
    If you ask nicely I'll give you a towel : )

    Great!

    Peculiar_One - October 24, 2007 - 03:54

    either method works. Essentially cPanel is creating the symbolic link for you and doing it through cPanel is fine. I don't do it through the command line I use my hosts panel. (not CPanel but same premise)

    That little tidbit just made my day! :) Thank you very much!

    I've just given it a whirl and it looks like progress has been made, however one thing is puzzling me, or rather--not working as I anticipated--and that is when I type the URL to my husband's site in Firefox instead of showing http://myhusbandssite.domainname.net/ in the address bar (as I was hoping it would), it jumps to and/or shows http://domainname.net/.

    Of course, I feel like a complete idiot questioning this since I know full well that I just went in cPanel and instructed it to do precisely that, but then again, I suspect I've still not got something right. Admittedly, I am still slightly perplexed about what the $db_url should read. By copying the settings.php file from the default directory it *should* be about as brand-spanking-new as I know how to get it as no alterations were made to the original Drupal install--I've not so much as even ran the initial cron job to make the pink status report box go away. I installed it and immediately began looking into how to set it up for multi-site without adjusting any settings or adding anything at all. But the copy of the settings.php file from the default directory names the database Drupal created during the original install. Can I just delete the rest of the line of code behind $db_url in the settings.php file in sites/myhusbandssite.domainname.net, save it and try accessing it again with crossed fingers and toes?

    by uploading a fresh settings.php drupal will find it and run install.php again. You will see the same screens you saw when you installed drupal the first time. you will enter your DB location DB username DB password and drupal will add it to settings.php as it orginally did. This time though you will enter the information for the 2nd DB (be it your husband or your daughter).

    Yeah, see, I'm not getting any of this. I used Fantastico to put the original install in, which I wouldn't think would matter if Drupal is being told to read/run the install.php script again but apparently that message isn't getting through. If you know why and would be so kind as to tell me, I'll nominate you for sainthood, too. ;)

    =-=

    VeryMisunderstood - October 24, 2007 - 14:07

    now you just added a variable that I can't help with. I don't use nor have I ever used fantastico to install Drupal.

    Personally, I'd scrap the fantastico install and work with a "normal" download that hasn't been altered by a 3rd party. This way you are always on same page with most of the people here in the support forums. Lastly, If that fantasico install is using any version of Drupal lower than Drupal 5.3 which was just recently released, than you are running an insecure version of Drupal. 5.3 includes patches to secure Drupal from hackers and fix some bugs that were found. AS of Drupal 5.x Drupal is no harder to install on your own using a download from drupal.org than it is to install using fantastico. IMO.

    That aside, I mistakenly gave you incorrect advice. A subdomain redirect isn't what you want to do. This is why you are having trouble getting the install and the proper addresss to show in the browser.
    what needs to be done is the 'document root' needs to be changed. In my host panel this is in the same menu as sub domain redirect, which is why I gave that advice incorrectly. Your host should be able to do this for you as well.

    Just explain to them that you want your subdomains document root to be your main domain. Provided you can't find a way to do it in your hosts panel.

    some of the conflict in advice between what I'm telling you to do and what the origainl thread is telling you to do is simply because the thread was based on 4.7 which did not have an auto installer built into Drupal that required a settings.php to be fresh.
    _____________________________________________________________________
    My posts & comments are usually dripping with sarcasm.
    If you ask nicely I'll give you a towel : )

    Good Advice

    Peculiar_One - October 24, 2007 - 23:30

    Personally, I'd scrap the fantastico install and work with a "normal" download that hasn't been altered by a 3rd party. This way you are always on same page with most of the people here in the support forums. Lastly, If that fantasico install is using any version of Drupal lower than Drupal 5.3 which was just recently released, than you are running an insecure version of Drupal. 5.3 includes patches to secure Drupal from hackers and fix some bugs that were found

    Good advice, thanks--I've done just as you recommended and now have that brand-spanking-new settings.php file I needed. It's amazing the difference a few extra ounces of information can make. :)

    Just explain to them that you want your subdomains document root to be your main domain. Provided you can't find a way to do it in your hosts panel.

    If you're feeling exceptionally patient and have the time, I'm still not grasping this concept. If my subdomain's document root is the same as my main domain's document root wouldn't that essentially be what I had going on with the redirect? Either way, I can't see anywhere in cPanel where I can do this so I have made an inquiry at my host's forum.

    Thank you for all of your help, though! By the way, I like your signature. :)

    =-=

    VeryMisunderstood - October 24, 2007 - 23:43

    If my subdomain's document root is the same as my main domain's document root wouldn't that essentially be what I had going on with the redirect?

    no. A redirect redirects traffic in total. a change of the doc root is essentially a symlink.
    a user goes to subdomain.yourdomain.com
    inside that folder is s small file that pushes users to your domain.com (without changing the address)
    drupal then handles scanning the sites. folder for a match based on the domain the user is coming from.

    you may want to follow this thread : http://drupal.org/node/123974

    from what I'm reading in there, there is something in cPanel called a subdomain manager, where you can point your subdirectory to your main directory. There is also a small script that can be run to create a symlink.
    _____________________________________________________________________
    My posts & comments are usually dripping with sarcasm.
    If you ask nicely I'll give you a towel : )

    Thank You

    Peculiar_One - October 25, 2007 - 01:49

    I think I understand it now. Thanks, too, for the link. Going to check that out stat.

    Have (almost full) shell access with PHP only

    fiLi - January 15, 2007 - 21:14

    Checkout the following solution - "PHPsh: Simple web based shell access to your server" on : http://www.psychogenic.com/en/products/PHPsh.php

    It does what the page you linked to offers, only it doesn't limit the commands used and it gives you the server's response.
    That would make this guide even easier. Thanks for writing it.

    This looks like useful

    bb37 - February 13, 2007 - 22:15

    This looks like useful information, but I'm having trouble making it work.

    I have shared hosting with cpanel access.

    I have a domain, domain1.net, that points to my shared host site and that works great.

    I have another domain, domain2.net, that also points to my shared host site.

    I have gone through the steps of creating /sites/domain2.net/settings.php.

    In cpanel, if I "park" domain2.net, then calls to that address display my domain1.net site. That's not what I want.

    If I unpark domain2.net and, instead, configure it as an "add-on" domain, cpanel creates /public_html/domain2. I have tried calls to domain2.net both with /public_html/domain2 in place and without. In the first case, I get a 403 error. In the second case, I get a 500 error.

    Also, when I try the symlink() php trick, I get the following response:

    Warning: symlink() [function.symlink]: No such file or directory in /home/username/public_html/setsymlink.php on line 3

    I like the "for dummies" approach because Drupal multisites have vexed me in the past. Does anybody have any additional help?

    Bob...

    I guess "parking" means

    cog.rusty - February 14, 2007 - 00:11

    I guess "parking" means using a domain pointer, which won't work here as you already noticed (because it redirects the request to domain1.net).

    Assuming domain1.net points to /public_html and that is where Drupal is installed:
    - create an "add on domain" for domain2 as you did
    - then delete (or rename) the domain2 directory (the one under public_html)
    - create a /public_html/domain2 symlink in its place, which points back to /public_html.

    To do this, your /public_html/setsymlink.php should contain symlink(".", "domain2"); and your public_html should be writable by all (777) when you run the script.

    Then set up /sites/domain2.net/settings.php as you did.

    Thanks for the quick

    bb37 - February 14, 2007 - 02:12

    Thanks for the quick reply.

    I used cpanel to make domain2.net an "add-on" domain. And I edited my setsymlink.php file, which is located in /home/username/public_html, to read as follows:

    <?php symlink(".", "domain2.net"); ?>

    I changed the permissions on setsymlink.php and the /home/username/public_html directory to 777.

    When I run setsymlink.php, I get a 500 error.

    I'm sure there's something simple I'm missing.

    Bob...

    When you create the

    cog.rusty - February 14, 2007 - 15:09

    When you create the domain2.net add-on domain, what directory does it create? Is it "/public_html/domain2", as you said in your first message, or is it a "/public_html/domain2.net" directory? The symlink should replace exactly that directory.

    Anybody seen my mind? I seemed to have lost it.

    Max_Headroom - October 11, 2007 - 20:55

    <?php
    symlink
    (".", "domain2.net");
    ?>

    I changed the permissions on setsymlink.php and the /home/username/public_html directory to 777.

    When I run setsymlink.php, I get a 500 error.

    I'm jumping in here as it is similar to my problem. I get the 500 error when I chmod public_html to 777. If it is 755, then I can create a link...
    but, it does not work. I read this thread and got all happy that I've found the solution, but I get "Server not found" error when I use my link.

    My setup:
    Using Cpanel. I have (a vanilla) Drupal 5.1 installed in public_html and I want to link a subdomain to it.
    I have a php file in public_html with the following line:

    <?php
    symlink
    (".", "dev.mysite.com");
    ?>

    The link gets created. I see it with ftp. If I open the link in ftp I see a mirror of my public_html.
    But if I run my subdomain (dev.mysite.com) URL in my browser, I get a "Server not found".
    My main URL works fine (mysite.com).

    I can link and unlink all over the place, but I can not get my link to start.
    O, and I have /public_html/sites/dev.mysite.com/setting.php where I use the same database but with

    <?php
    $db_prefix
    = array(
         
    'default'   => 'dev_',
         
    'users'     => 'shared_',
         
    'sessions'  => 'shared_',
         
    'role'      => 'shared_',
         
    'authmap'   => 'shared_',
         
    'sequences' => 'shared_',
        );
    ?>

    Am I missing something (besides my mind, lost that a few hours ago)?

    (no title)

    cog.rusty - October 11, 2007 - 21:12

    I guess you created the subdomain using your cpanel.

    Usually when you create a "dev" subdomain to be accessed as "dev.example.com", your cpanel creates a corresponding subdirectory which is named just "dev", that is, "public_html/dev"

    So (usually) you delete that "dev" subdirectory and replace it with a symlink named just "dev", because this is where your subdomain goes. Give it a try.

    symlink(".", "dev");

    Sorted!

    Max_Headroom - October 12, 2007 - 07:54

    I had a subdomain created with Cpanel, but I removed it again with Cpanel (not by deleting the the subdirectory). Maybe that's where the spanner hit the fan.
    I did as you said, and I am now the happy owner of 2 Drupal sites with a third in the works. :-D

    Thanks Saint Rusty ;-)

    Permissions set to 777?

    russgri - January 30, 2008 - 06:42

    Since you are on a shared server, your php may be run as cgi ... phpsuexec sp?
    If so you will need to use 755 or it will return an error.

    Check out by running phpinfo.php.

    Domain Pointer

    hliverance - May 10, 2007 - 21:49

    Rusty, I read with interest your very meticulous dialog about multisite setup for Drupal. Fantastic dialog, and very helpful! Your patience is astounding. So are you a saint?

    I have a question. I'm working on a christian teaching website, I have a test server sitting in my office with two domain names pointing to my IP address. It seems I need something that you referred to as a "domain pointer" to point each one to its respective directory so I can get Drupal to implement the symlink method for managing multiple sites. What do I have to do to set this up? Is this a function of the Apache WebServer? Thanks for your help.

    If you have full control of

    cog.rusty - May 11, 2007 - 02:51

    If you have full control of Apache, it should be only an Apache matter -- no symlinks required. In that case what you need to do is to set up Apache vhosts for the sites. Either in apache/conf/httpd.conf or in apache/conf/extra/httpd-vhosts.conf (depending on your Apache version) you can add a couple of vhosts with something like this:

    NameVirtualHost *:80
    <VirtualHost *:80>
        ServerName domain1.com
        ServerAlias www.domain1.com
        DocumentRoot "/blah/blah/drupal"
    </VirtualHost>
    <VirtualHost *:80>
        ServerName domain2.com
        ServerAlias www.domain2.com
        DocumentRoot "/blah/blah/drupal"
    </VirtualHost>

    Notice that the document root for both sites is already the same full path, Drupal's installation directory, so you don't need any symlinks -- just Apache.

    Symlinks are only needed in some standard shared hosting setups where cpanel automatically puts the sites on different directories, in which case you need to bring them together.

    Apache Virtual Host Settings

    hliverance - May 14, 2007 - 16:34

    Symlinks are working now. But, since I do have full control of this server, I will try the Apache Virtual Host method. Thanks so much for your help!

    2 different domains - independent accounts

    skhatri - February 16, 2007 - 06:02

    possible to share 1 multi site drupal? i guess symlinks won't work across accounts as 1 account won't have perms to the other. other methods? this capability would be enormously beneficial, as you can imagine.

    Shahnawaz Khatri, owner
    Internet Marketing 4 Real Estate
    www.internetmarketing4realestate.com

    No shell access

    lgwapnitsky - March 13, 2007 - 20:37

    How would I go about creating the symlink without shell access or something like cPanel? I only have FTP access and would like to implement this.

    Thanks,
    Larry

    See above

    cog.rusty - March 14, 2007 - 05:27

    See above http://drupal.org/node/107347#comment-187038
    You need only FTP.

    The details may vary slightly, depending on where you have your Drupal directory and to which directories your other domains/subdomains point.

    For example if Drupal is on your web document root and you have subdomains which point to subdirectories, then it would be like this http://drupal.org/node/107347#comment-200167

    subscribe

    yngens - April 19, 2007 - 03:26

    subscribe

    multisite madness

    c0mputerking - August 4, 2007 - 20:51

    Hello i have installed drupal 5 and the multisite module however i cannot get the multisite module to work correctly. I sort of have it working but not really it seems to create the all the sites in the same place ie example.com takes me to a main site where i can access all the other sites created by the multisite module. Therefore i have tried to create the multisites manually using this how to for dummies.

    I use webmin to generate new websites and have full control over my server. Webmin is setup to create
    A user named example and a group also named example with shell access and a home directory of /home/example
    A dns entry or A record for the new site that points to example.com
    A apache vhost for the new site example.com that points apache to /home/example/public_html/drupal looks like this

    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /usr/home/example/public_html/drupal
    ErrorLog /usr/home/example/logs/error_log
    CustomLog /usr/home/example/logs/access_log combined
    ScriptAlias /cgi-bin/ /usr/home/example/cgi-bin/
    DirectoryIndex index.html index.htm index.php index.php4 index.php5

    Options Indexes IncludesNOEXEC FollowSymLinks
    allow from all

    allow from all

    A mysql user and database both named example
    After alot of time and effort i made all of this work

    Now for the drupal stuff, how do i make drupal multisite work correctly either manually or with the module??
    manually I have tried creating the directory /usr/local/www/drupal5/sites/example. I then copied the settings.php file from the sites/default directory to the sites/example directory.

    I made the following changes to the settings.php file to match up with the new drupal site i am trying to create

    $db_url = 'mysql://example:examplepassword@localhost/example';
    $db_prefix = 'drupal_';

    Then I sym linked it to /home/example/public_html/drupal using this command
    ln -s /usr/local/www/drupal5/sites/example/ /usr/home/example/public_html/drupal
    Apache just serves a directory listing page with settings.php not a durpal site.

    I would prefer to have the entire multisite except for the core files contained in the users home directory but do not really care and can use sym links pointers whatever i just want multisites to work.

    PLEASE HELP I AM GOING MAD

    Here is the code that mutlisite module suggested i add to my settings.php and below is the setting the recommend for apache.

    #----CODE BEGIN-----
    $requri = explode('/', request_uri());
    if (sizeof($requri) >1 && $requri[1]=='site' && $requri[2] != '') {
    $my_site_base = $requri[2];
    # #this will be the database shared between the main site and the shared sites
    # have changed this confused
    $db_url = 'mysql://example:examplepassword@localhost/example';
    #
    $db_prefix = $my_site_base."_";
    $base_url = "http://example.com/site/$my_site_base"; // NO trailing slash!
    # }
    # ----CODE END-------

    I am confused as to what is going on here the shared database? I would like to have drupal create its entries in the users database and not share or do need to share some stuff but not all??

    Also my site base?? where does this come from and will it substitute example.com somehow?

    base url again what is going on here looks good but something is wrong

    AliasMatch ^/site/\w+/(.*) /usr/local/www/drupal5/us$1
    DocumentRoot /usr/local/www/drupal5/

    # WARNING:CLEAN URLS demand a much more complicated setup with a bunch of rewrite rules.
    # See the Appendix in this file for details

    (no title)

    cog.rusty - August 4, 2007 - 23:39

    I am only talking about a manually created multisite (no multisite module).

    I have tried creating the directory /usr/local/www/drupal5/sites/example.

    The name of the directory for any site should be a full site URL, such as:
    /usr/local/www/drupal5/sites/example.com
    /usr/local/www/drupal5/sites/www.example.com
    /usr/local/www/drupal5/sites/example.com.subdirectory
    /usr/local/www/drupal5/sites/subdomain.example.com

    Then I sym linked it to /home/example/public_html/drupal using this command
    ln -s /usr/local/www/drupal5/sites/example/ /usr/home/example/public_html/drupal
    Apache just serves a directory listing page with settings.php not a durpal site.

    What is "/usr/local/www/drupal5" and what is "/usr/home/example/public_html/drupal"? Is Drupal installed in a completely different place and you want to redirect to that? If so, make sure that "/usr/local/www/drupal5" is web accessible.

    If you are trying to redirecto to Drupal's sites/example (or sites/example.com) directory, this is wrong. The /sites subdirectories are only intended for internal use by Drupal. In a Drupal multisite, the requests for all the sites go to Drupal's installation directory, and Drupal's index.php is run, it compares the request with the names of the /sites subdirectories and serves the appropriate site.

    If what you want to do is have the vhost lead to "/usr/home/example/public_html/drupal" which is a symlink, and you have Drupal currently installed in "/usr/local/www/drupal5", then you would use:

    ln -s /usr/local/www/drupal5 /usr/home/example/public_html/drupal

    Also, it is safest not to set a $base_url in any of the settings.php files if there is no special reason. Sometimes adding a "www" where it is not needed can cause problems with login, or an old setting may be forgotten there after a domain change. Without a $base_url Drupal can adjust for these cases automatically.

    mysql

    skyline5k - September 11, 2007 - 11:26

    Referring to

    Using phpMyAdmin, create the tables and default data in your database by suitably modifying the drupal database file ("database.sql").

    I searched the initial zip file for the mysql file, but i'm either blind due to a 4 day migraine, or it's not there (drupal 5.2). Is it just as possible to export an initial sql installation via phpmyadmin, then edit it in notepad & import that to the new database?

    If not... where is the sql file?

    (no title)

    cog.rusty - September 11, 2007 - 15:03

    That was written for Drupal 4.7.

    In Drupal 5
    - there is no "database.sql" file and the installer itself does the "editing" for table name prefixes (if any).
    - you don't import the initial tables yourself
    - and you don't put the $db_url yourself in your settings.php (or else the installation will fail).

    Just skip steps 3 and 6 of that section, and at the end point your browser to that site's URL.

    so far so good...

    skyline5k - September 12, 2007 - 01:52

    Got the symlinks down (I think). www.symlinked.com is going to www.drupalinstall.com. But it's not creating a multisite. It's only a forward.

    I have /sites/symlinked.com
    /sites/symlinked.com/themes
    /sites/symlinked.com/settings.php

    I tried using the default settings.php copied onto symlinked.com's folder. That only brought me to my main page, and when i change something on symlinked.com, it changes drupalinstall.com also.

    So I changed the settings.php to look for a separate database. Now the page is blank and it's not asking for an install or anything. Did I miss a step somewhere?

    I made the symlink forward directly to drupalinstall.com, not drupalinstall.com/sites/symlinked.com. This is right, from what I read... right?

    (no title)

    cog.rusty - September 12, 2007 - 03:14

    If symlinked.com brings you to Drupal at all, then it points to the right place and your symlink is right.

    The question now is why Drupal cannot tell them apart.
    - Do you have any custom apache rewrite in your .htaccess which changes the URL to the first one?
    - What are your sites directory names? Are they

    sites/drupalinstall.com
    $base_url = 'http://www.drupalinstall.com'; // or commented out with a #
    $db_url = '***first database settings***'

    sites/symlinked.com
    $base_url = 'http://www.symlinked.com'; //force that, just in case
    $db_url = '***fresh, as uploaded***';

    Is the new directory readable by apache? (755)
    Is the fresh settings.php file readable and writable by apache? (666)

    Drupal is installed at the

    skyline5k - September 12, 2007 - 03:26

    Drupal is installed at the main level. i.e. www.drupalinstall.com and