I'd like to contribute the following to Drupal's documentation, but I'm fairly new to Drupal, so I'm posting it to the forum first. Any sort of feedback is most welcome. . .
Much of this guide comes directly from the excellent Multi-site setup in 5.x using cPanel guide by jsimonis, which works a treat for Drupal 5 installations. Unfortunately, that technique didn't work with my Drupal 6 multi-site installation, but after some relatively minor adjustments, this is how I got it working on my Web host:
1. Create your initial Drupal 6 site. In this example, the URL is www.yourdomain.com and the first MySQL database is site1db.
2. Use cPanel to create a new MySQL database for your second site, which we'll call site2db.
3. Use cPanel's file manager to create a new folder in your Drupal sites/ folder which matches the URL you want for the second site. In this example, in which we want a subdomain called site2.yourdomain.com, we would create a folder called site2.yourdomain.com. (If you prefer the URL to be yourdomain.com/site2, you would create a folder called yourdomain.com.site2).
4. Download and edit the settings.php file from the sites/default folder, replacing the line containing your first site's datbase information with your second site's database details, eg:
$db_url = 'mysql://username:password@localhost/site2db';
Change the username and password, if required, to reflect the cPanel user settings for the second database (site2db). Then upload the edited settings.php file to the new folder you created in step three (site2.yourdomain.com).
5. If you want a subdomain for your second site, create one now in cPanel. For the above example (site2.yourdomain.com), a folder named site2 will be automatically created by cPanel.
6. Delete the folder that was created for the subdomain.
7. Now create a symlink using a PHP file with this syntax:
symlink( 'path-to-drupal-installation', 'subdomain-folder' );
In our example, the PHP file would look like this:
<?php
symlink( '/home/username/public_html/', 'site2' );
?>Of course, you would change the path to the real path to your root Drupal folder.
8. Save the file as multisite.php and upload it to your site's web root, eg: /home/username/public_html/
9. Go to the location of this php file in your browser (eg www.yourdomain.com/multisite.php). The Web page will appear blank but it will have done its job by creating the symlink.
10. Now use your browser to run Drupal's install.php script on your second site. In our example, we would go to this URL: www.site2.yourdomain.com/install.php.
11. Drupal should now be ready to install.
A couple of notes:
Firstly, our multisite.php file would be exactly the same as the above example if we had opted for this URL for our second site: www.yourdomain.com/site2.
Secondly, this technique works even if your Drupal 6 installation is in a separate folder off your site's web root. I do this myself to enable me to run both Drupal 5.x and 6.x test sites on the same site. For example, if Drupal is installed in a drupal6 folder off the web root, the path in multisite.php would be:
symlink( '/home/username/public_html/drupal6', 'site2' );
However, multisite.php still needs to be uploaded to (and run in) your site's web root, eg: /home/username/public_html/
So that's about it. If there are any inaccuracies in the above, please add a comment here.
Comments
on PC
I am trying to do this as mensioned Have drupal6 as main installation and site1.net and site2.net as second and third sites. I have configured virtual host in xampp, I have setup stings.php too, when trying
http://sie1.net/install.php
geting error like this
The requested URL /install.php was not found on this server.
extend a hand please
thanks in advance
sherif
Dreamweaver extension
Try this . . .
My posting above was designed for use on a typical Web hosting provider, with Linux servers running cPanel. I've created another posting for setting up multi-site on a Windows PC. Let me know how you go with this.
It works like a charm, but
It works like a charm, but needs to be tweaked a bit if your main site is already in a subdomain.
e.g.
sub.domain.com (main site)
sub.domain.com/site2 (Site 2)
Multisite.php:
symlink( '/home/user/public_html/sub/', 'site2' );
And this is placed and run from the sub directory, instead of the root.
Yes, of course, sorry . . .
I didn't think of that option. I also have Drupal installed in a sub-folder (eg /home/user/public_html/drupal/) but in my setup, I have given each Drupal site its own sub-domain (eg site1.domain.com and site2.domain.com). So in my case, each symlink had to contain the path to the Drupal installation, eg
symlink( '/home/username/public_html/drupal', 'site2' );but needed to be run in the root, /home/user/public_html/.Not a blank page
i hit the multisite.php and got this message:
Warning: symlink() [function.symlink]: Permission denied in /home/username/public_html/multisite.php on line 2
do u have any idea?
Change the folder's permissions
Okay, hopefully that's easily fixed by changing that folder's permissions. After step 8 in my posting above:
Multi-site setup problem with one.com hosting
Hello there,
Several steps there that unfortunately do not apply to my installation with the hosting I'm using: one.com.
Administration is not with cPanel but something called ilosoft. But that's not really important I guess.
Important difference with your explanation is that executing the symlink script doesn't seem to have any effect. I had no problem testing my multi-site configuration locally. I want to use a subdomain to get to my addtional sites.
In my local setup, I created host names in /etc/host. I created apache configuration files under /etc/apache2/sites-available for each additional site. I had the right Alias directives in it to have the requests been mapped to the drupal root. I had the right directories for each site under the sites directory of my drupal code. So I had something like...
sites/mysite.com with a settings.php
sites/mysubdomain.mysite.com.site1 with a settings.php
sites/mysubdomain.mysite.com.site2 with a settings.php
Evereything works perfectly as long as I test it locally.
But after upload to my webspace on one.com (and after creating a webalias such as mysubdomain.mysite.com with value mysite.com) I always get a not found error after typing http://mysubdomain.mysite.com/site1 or http://mysubdomain.mysite.com/site2. I know the web alias works because http://mysubdomain.mysite.com shows exactly the same as http://mysite.com, the main site. And the uri remains intact (unlike a web forward): http://mysubdomain.mysite.com. I thought this should have been enough for Drupal to decide which site to render. It says in the install script that the url is used to establish the site being requested. In my case, after typing http://mysubdomain.mysite.com/site1, I was hoping I was going to see the site I had seen while testing locally with all relevant files under sites/mysubdomain.mysite.com.site1.
Unfortunately not.
Any idea on how to handle this?
Web-alias and one.com
You can have a look at this thread: http://drupal.org/node/322984#comment-1085359
I am struggeling with the same issue. Url seems to be the same (in the address bar) when using web-alias at one.com.
The url is not passed on, so drupal never checks for other sites in the ~/sites directory.
Mike
Does this support
Does this support 'universal' users?
No
I received your email, Jake, but I'll respond here, because forums are the right place to ask support questions. . .
Anyway, no, multi-site uses a different database for each site, which means the users are separate too. I think I remember seeing one or two contributed modules that allow sites to share users, so check out http://drupal.org/project/Modules/. An easier option is to just allow (and encourage) use of OpenID.
All was going well but....
I got as far as the location of multisite.php in my browser - a blank page appeared as described.
When I directed it to install.php (www.site1.mydomain.com/install.php) I got the 'Drupal already installed...' message!!
Where have I gone wrong?
I even changed the database settings in sites/www.site1.mydomain.com/ folder back to default ('mysql://username:password@localhost/databasename') hoping to get a prompt that a database, username and password should be entered. No joy!
If you have any idea where I am going wrong and can help then please do - I have been going mad trying to get multi site set up and am on the verge of throwing in the towel and just going with multi installation.......
This should help
ignore!
Thank you very much.
Thank you very much. Brilliant help for installing multisite Drupal using cPanel without need to access httpd.conf and so on...
Simply said, Alleluia!!
Glen, i o u a big one!
It's been a long week. It's been a long and hot day. I was ready to give up and drag myself to the local bar when i found your post. 10 pm, I've been at it since 9 am. Barely ate anything. A quick read convinced me that this post was worth a final try. 2 minutes later, there I was jumping up & down... IT WORKS!!! :-)
Thank you for taking the time to go the extra distance, for not assuming that i and perhaps others are full-fledged geeks. Although I must admit that just maybe i've earned my first Drupal t-shirt with this post printed on it!
If I'm ever in Autralia, I'll be sure to look you up.
If you're ever in Montreal (Canada) and you need a place to stay, you've got it.
Cheers all,
Renaud
p.s. One small thing. My Drupal installation is off my site's web root as are a bunch of other sites. To launch the Drupal website, one nedds to go to 'myDomainName.com/drupal'. What's the best way to go directly without the '/drupal' ?
:~: Senior Drupal Developer
This works for me
Thanks for the nice feedback, Renaud. If you want to install drupal in a subfolder and have it show up as the root folder, this great drupial.com tutorial worked perfectly for me. However, I have adapted it to make it a little more search engine friendly, as recommended by this webmaster tips tutorial. So I have this .htaccess file in the root folder of my site (ie public_html):
The second and third lines just redirect
www.yoursite.comtoyoursite.com. The last nine lines redirect from the root to the Drupal installation folder, while keeping the root URL. Obviously, you'd replaceyoursite.comwith your own URL andyourfolderwith the name of your Drupal installation folder. Good luck!Caveat: I'm not an Apache/Drupal guru. I've just cobbled together this solution and it works for me. To any real Apache/Drupal gurus, please let me know if I've made any errors here.
Works for me to
Hey Glenn,
Works just fine, merci encore! Although i feel i'm looking at something of a Rosetta stone (black box). Where's Champollion when you need him!? For now, i'm happy just believing what i get.
Sub-question - There is an 'htaccess' file inside the drupal directory (/home/me/public_html/drupal). And in this file, at the bottom, code that looks like it does more or less the same. Am i right to think that this file is being trumped by the root 'htaccess' file? What if there was nothing in the root 'htaccess' file? Is there a way to setup the 'drupal/.htaccess' file to get the same results i'm now happily getting with your 'Rewrite' code?
Renaud
:~: Senior Drupal Developer
I don't know but I would leave it
I doubt it. I would leave that .htaccess file as is. But to be honest, I don't know - I'm no Apache expert.
Hostmonster.com
I'm running my sites at hostmonster.com and their policy stipulates that the primary account and all addon/subdomains must reside in the root of public_html.
With this in mind, should symlinks to /sites folder work for a multisite install?
Also, I'm presuming that symlinks created at the command line achieve the same result as what you've specified using the multisite.php file.
Thanks for your help. :-)
Getting error The page isn't redirecting properly after install
First of all thanks for the easy to understand guide it was a real help. I have used all the procedure that you prescribed in above and after running multisite.php got the install page for drupal for the xyz.abc.com domain with abc.com already having a drupal installation. After successfully installing for this new domain when I was shown a successful install and visit your site link I tried to go there following the given link. But I am getting this error
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
Would it be possible for you or any one else to let me know where I am getting things wrong. Thanks in advance.
I get the same error on mine
I get the same error on mine and it doesn't seem to matter what I do. I never get the installation page, just that firefox tells me the page is redirected in a way that will never complete. However if I remove the folder sites/sub.domain.com then I get correctly directed to domain.com drupal site. Does anyone have ANY clue about this error??? This is very annoying.
Shane
I would love it if some of
I would love it if some of you multi-site guru's could take a look at my blog post about how I used the above instructions, but they did not work. I was not able to attach images to this post, so I created a blog post about every step and result I had, please see it at http://www.socalcreations.net/blogs/drupal-multi-site-testing and then comment here.
Thanks
Surprised I missed this..
I'm surprised that I missed this posting somehow.
I'm hoping to write up some better documentation on stuff like this for both Drupal 6 and 7. I know a lot more people are going with multi-site installs because they are much easier to maintain. Thus far I've done setups that only had 2 sites to ones that had almost 30.
I try to keep an eye out for discussions on multi-sites, but sometimes I miss them. I don't get to the forums as often as I would like, so I miss a lot that is posted in here. Please feel free to use my contact link to send me questions. Every once in a while I get them and I try to help out if I can.
So Jenni, have you had a
So Jenni, have you had a chance to take a look at my blog documentation of the steps I have done?
http://www.socalcreations.net/blogs/drupal-multi-site-testing
I got this reply from Hostmonster today
wrote:
To fix this issue you will need to run this multi-site installation from a sub-domain. To do this just go to your cpanel -> domains -> subdomains and create a sub-domain that points to your public_html/claude symlink. Going to this new sub-domain will work. To show this to you I have created a sub-domain at http://claude.socalcreations.net/
Apparently this tech did NOT test out what he did, because the URL of http://claude.socalcreations.net/ still goes to a forbidden page with additional errors of 500 (internal).
Making the attempt to use http://claude.myreisystem.com/install.php or http://www.claude.myreisystem.com/install.php still results in either forbidden or internal 500 error pages.
I could really use expert eyes for multi-sites to read my documentation blog to see if there is something I am missing....there are plenty of images and results listed in order of procedure.
http://www.socalcreations.net/blogs/drupal-multi-site-testing
Thanks Group!
Sent an email...
I sent over an email yesterday a little after 5 p.m. PST. Did you not get it?
May be missing the install.php
I Read your blog as I was having the exact same experience. I had done a softaculous install on a greengeeks server setup with cpanel. For whatever reason - perhaps as a function of how softaculous deploys - the "install.php" file was missing from the root of the drupal install. I pulled that file from a fresh download of the drupal install files (6.17 in this case) and pub'd it into the rood of the drupal directory (in my case public_html/drupal/ ) Then I his my site1.drupalinstall.com - the same address I was getting the redirect loop errors from - and everything worked.
That's not my case, the
That's not my case, the install.php file is there.
I had to take a 10 day break from this project while I had other training to do, but now I am back at this and still seem to be running in to similar issues.
Jenni Simonis, I would like to connect with you via Skype and screen share to help discover what the issues maybe, please let me know what your availability is.
Availability
I'm available Wed-Thur, Sat after 3 p.m. PST this week. My Skype is jenni.simonis
Just let me know if that works for you. If not, we can figure out something that will work. I'm regularly up quite late (which is why I'm not typically available until late afternoon). But with advance warning I can alter the times to fit other availabilities.
You can use my contact form to let me know, if you'd like. That'll come to my email, which I'll see quicker than the forums here.
Jenni
Thank you, boldart
You saved my day :)