• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 30 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: multiple sites on 1 install
PostPosted: Tue Jul 19, 2005 4:48 pm 
Is it possible to set up multiple sites using 1 install?

domain/dept1
domain/dept2
domain/dept3

all running off of 1 installation of cmsms.


Top
  
 
 Post subject: Re: multiple sites on 1 install
PostPosted: Tue Jul 19, 2005 4:51 pm 
Offline
Administrator
Administrator
User avatar

Joined: Fri Jun 11, 2004 6:58 pm
Posts: 3338
Location: Fairless Hills, Pa USA
No, there is no way to share 1 install across 3 separate sites.  But you can share 1 database by using different table prefixes.  Almost as good.  :)

_________________
http://about.me/tedkulp


Top
 Profile  
 
 Post subject: Re: multiple sites on 1 install
PostPosted: Tue Aug 30, 2005 12:30 am 
This should be possible if you use the HTTP_HOST env variable. We're planning to use the following method to implement a multi-site installation ourselves.

First you need a separate subdomain for each site:

dept1.domain
dept2.domain
dept3.domain

Then in config.php get the value of $_SERVER['HTTP_HOST'] and use that in your url settings instead of the hardcoded domain.

e.g.
$MYHOST = $_SERVER['HTTP_HOST'];
$config['root_url'] = "http://$MYHOST";
etc

You can strip off '-' and '.' from the hostname and use that as your database name and in your uploads path so you have a different upload directory for each site.


Top
  
 
 Post subject: Re: multiple sites on 1 install
PostPosted: Tue Aug 30, 2005 2:25 pm 
Yes, as nuspace said, it should be possible. I'm just thinking off the top of my head, but here's some ideas on how to work it. Remember, this only works in theory, don't expect it to actually work quite right.

Easiest -- subdomians:

for example

sub1.domain.yours
sub2.domain.yours
etc.domain.yours

now make sure they all point to the same place on your server (were you installed CMS, probably called htdocs) and then go the the first url. CMS will guide you through the installation. Just do things as normal if you were installing that CMS. When you are done, go to the config.php file, it will look something like this:


$config['dbms'] = 'mysql';
$config['db_hostname'] = 'localhost';
$config['db_username'] = 'root';
$config['db_password'] = 'somepasswdiwillnotshowyou';
$config['db_name'] = 'cms';
$config['db_prefix'] = 'cms_';
$config['root_url'] = 'http://localhost';
$config['root_path'] = '/var/www/localhost/htdocs';
$config['query_var'] = 'page';
$config['use_bb_code'] = false;
$config['use_smarty_php_tags'] = false;
$config['previews_path'] = '/var/www/localhost/htdocs/tmp/cache';
$config['uploads_path'] = '/var/www/localhost/htdocs/uploads';
$config['uploads_url'] = 'http://localhost/uploads';
$config['max_upload_size'] = 1000000;
$config['debug'] = false;
$config['assume_mod_rewrite'] = false;
$config['auto_alias_content'] = true;
$config['image_manipulation_prog'] = 'GD';
$config['image_transform_lib_path'] = '/usr/bin/ImageMagick/';
$config['use_Indite'] = false;
$config['image_uploads_path'] = '/var/www/localhost/htdocs/uploads/images';
$config['image_uploads_url'] = 'http://localhost/uploads/images';
$config['default_encoding'] = '';
$config['disable_htmlarea_translation'] = false;
$config['admin_dir'] = 'admin';
$config['persistent_db_conn'] = true;
$config['default_upload_permission'] = '664';
$config['page_extension'] = '.shtml';
$config['locale'] = 'en_US';

?>

note that some of the options will work for all sites, and some need to be customized. To do that do this:


// these are the variables that are the same for everthing
$config['dbms'] = 'mysql';
$config['db_hostname'] = 'localhost';
$config['db_username'] = 'root';
$config['db_password'] = 'somepasswdiwillnotshowyou';
$config['persistent_db_conn'] = true;
$config['db_name'] = 'cms';
$config['root_path'] = '/var/www/localhost/htdocs';
$config['max_upload_size'] = 1000000;
$config['query_var'] = 'page';
//etc etc

//these are the ones that vary from one subdomain to another
switch ( $_SERVER['HTTP_HOST'] ){

case 'sub1':
$config['db_prefix'] = 'cms1_';
$config['root_url'] = 'http://sub1.domain.yourst';
$config['use_bb_code'] = false;
$config['use_smarty_php_tags'] = false;
$config['previews_path'] = '/var/www/localhost/htdocs/tmp1/cache';
$config['uploads_path'] = '/var/www/localhost/htdocs/uploads1';
break;

case 'sub2':
$config['db_prefix'] = 'cms2_';
$config['root_url'] = 'http://sub2.domain.yourst';
$config['use_bb_code'] = false;
$config['use_smarty_php_tags'] = false;
$config['previews_path'] = '/var/www/localhost/htdocs/tmp2/cache';
$config['uploads_path'] = '/var/www/localhost/htdocs/uploads2';
break;


case 'etc':
$config['db_prefix'] = 'cms3_';
$config['root_url'] = 'http://sub2.domain.yourst';
$config['use_bb_code'] = false;
$config['use_smarty_php_tags'] = false;
$config['previews_path'] = '/var/www/localhost/htdocs/tmp3/cache';
$config['uploads_path'] = '/var/www/localhost/htdocs/uploads3';
break;
}

?>


Of course I left stuff out, but I hope that's enough fo you to work off of. The other method would be to use as you seed and have it like

domain.yours/sub1
domain.yours/sub2
domain.yours/etc

You would have to perform a fair amount of magic with mod_rewrite though to get it working properly, so I won't try and explain it here.


Top
  
 
 Post subject: Re: multiple sites on 1 install
PostPosted: Tue Aug 30, 2005 9:29 pm 
I didn't even think of using a switch. :) You're right, your treatment is more thorough. But if you're happy to have settings such as use_bb_code and use_smarty_php_tags the same for each site, here's a shorter way to do it:

$MYHOST = $_SERVER['HTTP_HOST'];
$MYSUB = preg_replace('/\..*$/', '', $MYHOST); // haven't tested this regexp but I think it should be right

$config['db_prefix'] = $MYSUB . '_';
$config['root_url'] = "http://$MYHOST";
$config['previews_path'] = "/var/www/localhost/htdocs/tmp-$MYSUB/cache";
$config['uploads_path'] = "/var/www/localhost/htdocs/uploads-$MYSUB";
$config['uploads_url'] = "http://$MYHOST/uploads-$MYSUB";
$config['image_uploads_path'] = "/var/www/localhost/htdocs/uploads-$MYSUB/images";
$config['image_uploads_url'] = "http://$MYHOST/uploads-$MYSUB/images";


Top
  
 
 Post subject: Re: multiple sites on 1 install
PostPosted: Tue Sep 06, 2005 1:50 am 
I just realised a flaw with my example from reading http://forum.cmsmadesimple.org/index.ph ... 455.0.html

The modules will all be shared, however, the module configurations will not be. This will probably not be a problem, but if you want to use a different template for a part of a module (most modules store tempates under the modules directory) than the other guy, it will be. There are work arounds though.


Top
  
 
 Post subject: Re: multiple sites on 1 install
PostPosted: Tue Nov 15, 2005 9:56 pm 
I've been an interested bystander on the multisite discussions with several CMS. It seems to me everyone is trying to meet this requirement from the same direction - one database but use separate prefixes for all or some of the tables.

An alternative approach is to add a "site" field to every table and modify the sql instructions to handle this field. To me, a major advantage of this approach it could be easily adapted to provide default values. For each current sql "select" statement prime the site value with the specific site value. If that is successful use the values retreived if returns an empty recordset change the site to the default value and try again.

This default value arrangement could be extended to provide groups of centres that all share the same characteristics and yet still provide individual settings. The sql would become possibly 3 layers. First set the site value to the specific site, if unsuccessful, set it to the group value and if that's unsuccessful, set it to the default value.

Anyway, it's just an idea.


Top
  
 
 Post subject: Re: multiple sites on 1 install
PostPosted: Wed Nov 16, 2005 12:47 pm 
As an advancement of that idea, you could include something like that in the cms_db_prefix() function.

If at page initialisation the domain being accessed was detected it could return something like:

cms_example.com

if it recognises the domain as in it's list of acceptable domains, and then if the domain wasn't recognised it could just return

cms_

which would be a database template containing all the default material.

It would avoid having to rewrite all the sql queries.


Top
  
 
 Post subject: Re: multiple sites on 1 install
PostPosted: Wed Nov 16, 2005 12:52 pm 
Come to think of it, when is the first call to the module architecture made? Would it be plausible to write a module that manages the list of domains to recognise. It might be somewhat monstrous, but I can't see why it (in combination with lots of calls to $_SERVER['SERVER_NAME']), could also manage allowing users access only to specifc sub domains for administration.


Top
  
 
 Post subject: Re: multiple sites on 1 install
PostPosted: Thu Nov 17, 2005 1:13 am 
Offline
Administrator
Administrator
User avatar

Joined: Fri Jun 11, 2004 6:58 pm
Posts: 3338
Location: Fairless Hills, Pa USA
I'm in favor of making it all in the same tables.  That allows us to not have to force people to setup anything extra on our end to add a new site.  Just create it and it goes.

However, that does mean that site id has to be added to most tables and a lot of stuff is going to break.

I'm kind of holding off on these big ideas until after 1.0 comes out.  And then the sky's the limit on what we can make better.  Lord knows there is enough that needs it.  :)

_________________
http://about.me/tedkulp


Top
 Profile  
 
 Post subject: Re: multiple sites on 1 install
PostPosted: Thu Nov 17, 2005 4:20 am 
Offline
Power Poster
Power Poster
User avatar

Joined: Fri Jan 07, 2005 1:52 am
Posts: 446
Location: Sydney, OZ
I can't help but feel that for large sites it woul dbe better to use a new DB for each. This would also avoid the issue of multiple tables for modules et al.

I'm thinking a new 'multisite admin package' that allowed you to administer multiple domains. Select the site you want and then you end up at the current CMS admin panel.

People would still need to enter requisite information for each site (domain, ftpserver, username, password, db_prefix etc). And then perhaps, one day, it may even be possible to deploy a new site from here by copyng the 'core file' across to the new site location, set permissions, and create the tables (and even the db given permission).

Hope that makes sense. I tend to ramble at this time of day. ;)

_________________
If at first you don't succeed, ask someone who knows how.


Top
 Profile  
 
 Post subject: Re: multiple sites on 1 install
PostPosted: Thu Nov 17, 2005 2:37 pm 
Offline
Forum Members
Forum Members

Joined: Tue Oct 18, 2005 8:30 pm
Posts: 163
Location: Elkhorn, WI
iNSiPiD wrote:
I can't help but feel that for large sites it woul dbe better to use a new DB for each. This would also avoid the issue of multiple tables for modules et al.

I'm thinking a new 'multisite admin package' that allowed you to administer multiple domains. Select the site you want and then you end up at the current CMS admin panel.

People would still need to enter requisite information for each site (domain, ftpserver, username, password, db_prefix etc). And then perhaps, one day, it may even be possible to deploy a new site from here by copyng the 'core file' across to the new site location, set permissions, and create the tables (and even the db given permission).

Hope that makes sense. I tend to ramble at this time of day. ;)
This is definitly the better idea. It wont require a major re-write of code/modules to use it. My hosting company is actually looking for something very close to this to offer to our clients. (more of a central install of the files, and each user get's the DB.)

I think this would be cool, but not on my high priority list. (i'd love to see some tuning changes first)


Top
 Profile  
 
 Post subject: Re: multiple sites on 1 install
PostPosted: Tue Nov 22, 2005 2:50 pm 
Offline
Forum Members
Forum Members

Joined: Tue Oct 18, 2005 8:30 pm
Posts: 163
Location: Elkhorn, WI
OK... so i have a question for you all....
My hosting company would like to install CMSMS for our clients. You know like a "one click install" type thing. I think this will be easier than what most of you are trying to accomplish.

1. They will all be on seperate domains.
2. They will all have seperate DB's.

The issue i have is we dont' want to copy all the files to their accounts, we want a central location for them all. So we plan on using symlinks to put the files under their account.

If we were to do that am i right when saying that these folders shouldn't be sym'ed?
/config.php
/tmp/
/uploads/

Correct? Or am i missing something?

I read somewhere that some modules store their templates on the filesystem and if people want to modify the tmplates... so i might have to copy the "modules" directory too.

What do you think?


Top
 Profile  
 
 Post subject: Re: multiple sites on 1 install
PostPosted: Tue Nov 22, 2005 4:28 pm 
Offline
Administrator
Administrator
User avatar

Joined: Fri Jun 11, 2004 6:58 pm
Posts: 3338
Location: Fairless Hills, Pa USA
Yeah, you're correct.  There is no reason why it shouldn't work. assuming apache is setup correctly to follow symlinks.

You can probalby get away with using the same modules directory if they all want to use the same version.  Any changes to modules files (like templates) go into the database or into tmp somewhere, so it shouldn't be an issue.

The only problem will be when you update a module, you'll have to go to each individual system and hit the upgrade button.

_________________
http://about.me/tedkulp


Top
 Profile  
 
 Post subject: Re: multiple sites on 1 install  [SOLVED]
PostPosted: Tue Nov 22, 2005 4:30 pm 
Offline
Support Guru
Support Guru
User avatar

Joined: Mon Jul 04, 2005 5:12 pm
Posts: 4827
Location: Ferrara, Italy
lemkepf wrote:
If we were to do that am i right when saying that these folders shouldn't be sym'ed?
/config.php
/tmp/
/uploads/

Correct? Or am i missing something?


Maybe there is a problem with fileloc.php [dirname(__FILE__) is the absolute filename path]

Alby

_________________
CMSMS Support Team
Italian Admin and Moderator

Plugins: Geolocate hostip, Multiple random image, Image rotator (beta), Content Pagination
Modules: ForumMadeSimple (Howto), TranslationManager
Multilingual: MLE is not CMSMS


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 30 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: lexscripta


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Arvixe - A CMSMS Partner