Multi Site installation - same code - different databases - sharing modules and themes
evyawebsites - January 23, 2008 - 15:10
i am installing the multi site configuration so i would share the module and thems between y websites but i keep getting errors, I installed all my drupal websites under :
hostname/sites/domain1
and configured the setting.php file within hostname/sites/all/default/setting.php as follow :
$db_url = 'mysql://username:password@localhost/databasename';
$db_prefix = array(
'default' => 'main_',
'modules'=> 'shared_',
'themes' => 'shared_',
);
i tried following the explainations in the handbooks but it does not seems to work for me, what do i miss ???

Do you want the database for
Do you want the database for each site to be completely independent, or do you want to share database table amongst multiple sites?
I suspect it's the first case.
If so, you don't need to share database prefixes. Set it up like this:
The folders /sites/all & /sites/default are normally already there.
In the folder /sites/all create 2 folders: modules & themes
If you want to have 2 sites, eg mywebsite1.com & mywebsite2.com, create the according folders in /sites directory.
You sites directory should now look like this:
So it looks like:/sites
- /all
- modules
- <your modules you want to share here>
- themes
- <your themes you want to share here>
- default
- mywebsite1.com
- settings.php
- mywebsite2.com
- settings.php
In the settings.php files in the folder mywebsite1.com you can simply put for example:
$db_url = 'mysql://username:password@localhost/databasename';
$db_prefix = 'site1_';
and settings.php for folder mywebsite2.com:
$db_url = 'mysql://username:password@localhost/databasename';
$db_prefix = 'site2_';
Alternately, you can just have 2 different database names for each site, and don't use a prefix for both.
Let me know if it works
Kind regards,
Sven
So in short: To share your
So in short:
To share your modules and themes across multiple websites, you just need to put them in the /sites/all/* folders.
No need to put anything in the settings.php to share them.
Just make sure all settings.php connect to different databases, or differently prefixed database tables.
Then you will have multiple standalone sites making use of the same Drupal code, modules & themes.
The sharing of DB tables through settings.php as you are doing in your mentioned code, is only usefull when you want to share DB tables across multiple standalone sites.
sill not working.,..
Thanks Sven,
i followed your instructions and implemented the setting.php file at :
../sites/all/website1/setting.php (instead of - sites/all/website1/sites/default/setting.php)
../sites/all/website2/setting.php
and i got the modules and themes folders in :
../sites/all/modules
..sites/all/themes
But when i go to the modules and themes list ih n the website admin section i do not see all the modules and themes i got in the "../sites/all/modules" folder
any suggestions ?
../sites/all/website1/setting
Your current, as in above post:
../sites/all/website1/setting.php (instead of - sites/all/website1/sites/default/setting.php)
../sites/all/website2/setting.php
should be:
../sites/website1/setting.php (instead of - sites/all/website1/sites/default/setting.php)
../sites/website2/setting.php
with the modules themes in:
../sites/all/modules
../sites/all/themes
or all together:
../sites/website1/setting.php (instead of - sites/all/website1/sites/default/setting.php)
../sites/website2/setting.php
with the modules themes in
../sites/all/modules
../sites/all/themes
../sites/website1/setting.php
../sites/website2/setting.php
Website1's setting.php, or whichever website you wish to be served up as the 'default', in case Drupal can't find a site matching the request, can be in the default folder.
../sites/all/modules
../sites/all/themes
../sites/default/setting.php <-website1's setting.php
../sites/website2/setting.php
If any of your sites are using themes or modules which are specific to it, they should be within their respective folder's within that site.
../sites/all/modules
../sites/all/themes
../sites/website1/setting.php
../sites/website1/modules
../sites/website1/themes
../sites/website2/setting.php
../sites/website2/modules
../sites/website2/themes
re-orginized the files But still not working...
i re-orginized the files as following :
../sites/all/modules
../sites/all/themes
../sites/default/setting.php <-website1's setting.php
../sites/website2/setting.php
but still when i go to my website admin section i do not see al the module and themes i got in these folders.
Please help
just to confirm
You log into your website as the administrator and go to /admin/build/modules and you do not see any of the modules that you placed in the .../sites/all/modules folder?
stiil not working );
Yes, i go to my website admin module list and i do not see the modules from sites/all/modules/*
i configured the setting.php files at sites/website1/setting.php - i only add the website db_perfix - ( $db_prefix = 'website1_'; )
while i left the files in sites/website1/sites/default/setting.php as they been created originally - ( $db_prefix = ''; )
could it be the problem ?
ok, I just wanted to make sure we were on same page
Not sure, I have never used the $db_prefix setting since I give each site their own database. As long as you have been consistent about your $db_prefix usage while moving the sites around, there shouldn't be a problem, but I may be wrong. That does happen too often! ;)
I can set up a test environment using prefixes to see if I can recreate that, but I probably won't have time to until later this week.
If you haven't added content, it may be easier and quicker for you to reinstall, unless someone else can offer some suggestions.
Multi Site setup
I am trying to set the multi site configuration,
i use the shared hosting from GoDaddy and i installed drupal 5.5 to the server for each website using a different Mysql database for each and the directory looks like this :
sites/
-All/
-Modules
-Themes
-default/
setting.php <- from website 1
-website1
-website2
i copied the setting.php from sites/all/website1/sites/default/setting.php
to ../website1/setting.php
and the same for website 2, But when i go to the admin section in my website to the modules list,
i do not see the module i got in the ../all/modules/*
any sugesstions out there ?
evyawebsites, So just to
evyawebsites,
So just to confirm what you're saying, you've setup a multisite installation with 2 sites. The 2 sites are loading fine. When you go to http://website1.com/admin/build/modules you see the expected list of modules (the code for these modules is living in sites/all/modules), but if you go to http://website2.com/admin/build/modules you don't see the modules??? If that's the case I'll need to think about this for a bit to see what might be causing that.
________________________
dave hansen-lange
Developer
Advomatic.com
Multi Site setup - share modules and themes
Hey Dave,
I have setup 2 websites with Drupal and i store them in ../sites/website1 and ../sites/websites2,
The modules and themes are stored in ../sites/all/modules and ..sites/all/themes
But when i go to both of these websites modules and themes list i see only the modules and themes i stored in ../sites/website1/* and ../sites/website2/* which are the specific modules for the site.
My goal is to use the same modules and themes from one location - ../sites/all/modules
with the 2 websites i currently run, What do you think ?
what do i do wrong here ?
Thanks,
Evyatar
Similar problem-maybe a clue
I used the multi-site setup because it looks like it is easier to maintain through upgrades and such. My production server is set up with my contributed modules and custom theme in /sites/mysite.com/modules and /sites/mysite.com/themes, respectively. Everything seems to be working fine.
I wanted to duplicate my production site on a development machine on my local network, which I did following the instructions at http://drupal.org/upgrade/copying-your-site-via-GUI . On the development machine copy, in site admin, I can only see the core modules and themes, which are in /modules and /themes. Messing around with /sites/default/settings.php and /sites/mysite.com/settings.php only caused even the core themes to disappear.
The thing that offered the most hope was changing the name of /sites/mysite.com to /sites/192.168.1.10, which is the address I use to get to the development machine on my network. Now all of the contributed modules and custom themes become available in admin. It is not a complete fix though, as a lot of things in the custom theme are now broken.
I'm guessing that the address in one's browser has something to do with how the site folders are found. I think I am conforming to the rules described in settings.php. Since I don't have a DNS server on my local network, I can't use my regular domain name. I don't yet understand enough about configuring DNS or Apache, but I suppose it is a simple setting in one of those two things. $base_url in settings.php might have someting to do with it too, but I haven't found a combination that works yet.
Randy
What am I missing?
I have been reading various threads about setting up multi-site drupal installations, but I am obviously missing something.
I have a drupal installation on my domain (for this example www.fred.com). I want to use drupal on a sub-domain (test.fred.com).
I understand I have to create a directory public_html/sites/test.fred.com with a setting.php containing the relevant database information (for my purposes a separate database).
When I point to test.fred.com how does it know to utilise the base drupal installation (www.fred.com) with the specifics from the ../sites/test.fred.com/setting/php? Do I need a .htaccess file in test.fred.com? If so what is the contents of this file? If this is not the case how does it work?
As I said I am obviously missing the obvious, but if someone could spell it out I would be truely greatful.
Craig
You need a Symbolic link for this
This multi-site overview at least addresses this question.
http://drupal.org/getting-started/5/install/multi-site#comment-925511
The text from the above is:
When using multi-site, if one of your sites appears to be in a subdirectory of your domain, you will need to add a symlink to that directory from the Drupal installation directory. Like this:
ln -s . subdir
where subdir is the name of your subdirectory.