Hosting multiple forums

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
paulius
Registered User
Posts: 17
Joined: Tue Jul 06, 2004 6:08 am

Hosting multiple forums

Post by paulius »

Hello,

I'm interested in knowing hwat is the best way to use phpBB to host multiple forums. For now, I have found one script that can host multiple forums froma single phpBB installation.

However, the script is not released under the GPL and is quite expensive.

Are there any other methods for multiple hosting or any free scirpts to do this?

Thanks.
Last edited by ric323 on Fri Apr 25, 2008 10:50 pm, edited 1 time in total.
Reason: Topic icon changed
Paulius
flogger12
Registered User
Posts: 14936
Joined: Tue Nov 25, 2003 2:13 am

Re: Hosting multiple forums

Post by flogger12 »

paulius wrote: Hello,

I'm interested in knowing hwat is the best way to use phpBB to host multiple forums. For now, I have found one script that can host multiple forums froma single phpBB installation.

However, the script is not released under the GPL and is quite expensive.

Are there any other methods for multiple hosting or any free scirpts to do this?

Thanks.

nobody I can find will give up the secrets at least not for free. :roll:

robert
paulius
Registered User
Posts: 17
Joined: Tue Jul 06, 2004 6:08 am

Re: Hosting multiple forums

Post by paulius »

flogger12 wrote:
paulius wrote:Hello,

I'm interested in knowing hwat is the best way to use phpBB to host multiple forums. For now, I have found one script that can host multiple forums froma single phpBB installation.

However, the script is not released under the GPL and is quite expensive.

Are there any other methods for multiple hosting or any free scirpts to do this?

Thanks.

nobody I can find will give up the secrets at least not for free. :roll:

robert


Guess I need to put my PHP hat on :D

Thanks for the reply anyways!
Paulius
espicom
Registered User
Posts: 17905
Joined: Wed Dec 22, 2004 1:14 am
Location: Woodstock, IL

Post by espicom »

The problem with using a single set of scripts is the configuration file...

I've personally been working on eliminating hard-coded stuff from PHPBB, because I have several active forums, plus some coming soon. I'd love to be able to have a single code base feeding them all, where all the executable stuff is just a symbolic link to the master copy. The two keys in my case were moving the forum logo out of overall_header.tpl (see link in signature) and fixing the hard-coded paths in Smartor's photo album mod (see this link on the Smartor site).

Now, what you're talking about CAN be done, by adding some magic. One set of files, multiple web addresses pointed at them, and each acting as an independent forum. How? A modified config.php script...

Code: Select all

<?php

if ($_SERVER["HTTP_HOST"] == "www.myhost.com")
{
	$dbms = 'mysql';
	
	$dbhost = 'mysql.myhost.com';
	$dbname = 'phpbb_sites';
	$dbuser = 'mylogin';
	$dbpasswd = 'mypassword';
	
	$table_prefix = 'myhost_';
	
}
if ($_SERVER["HTTP_HOST"] == "cars.myhost.com")
{
	$dbms = 'mysql';
	
	$dbhost = 'mysql.myhost.com';
	$dbname = 'phpbb_sites';
	$dbuser = 'mylogin';
	$dbpasswd = 'mypassword';
	
	$table_prefix = 'cars_';
	
}
if ($_SERVER["HTTP_HOST"] == "cycle.myhost.com")
{
	$dbms = 'mysql';
	
	$dbhost = 'mysql.myhost.com';
	$dbname = 'phpbb_sites';
	$dbuser = 'mylogin';
	$dbpasswd = 'mypassword';
	
	$table_prefix = 'cycle_';
	
}
define('PHPBB_INSTALLED', true);

?>
Jeff
Fixing 1016/1030/1034 Errors | (obsolete link) | MySQL 4.1/5.x Client Error | phpBBv2 Logo in ACP
Support requests via PM are ignored!
"To be fully alive is to feel that everything is possible." - Eric Hoffer
flogger12
Registered User
Posts: 14936
Joined: Tue Nov 25, 2003 2:13 am

Post by flogger12 »

hey, I like that, I am going to go play with that.

thanks,
robert
espicom
Registered User
Posts: 17905
Joined: Wed Dec 22, 2004 1:14 am
Location: Woodstock, IL

Post by espicom »

In two words, it works... I've got three forums running on one directory, using this. I'm using "regular" (ip-based) virtual hosts, but it should work with name-based virtual hosts, too.

But, you need to get rid of the hard-coded stuff. And it does not have provisions, as it sits, for doing INSTALLS using the "standard means". I have ways around that, but it is NOT something for the average user!
Jeff
Fixing 1016/1030/1034 Errors | (obsolete link) | MySQL 4.1/5.x Client Error | phpBBv2 Logo in ACP
Support requests via PM are ignored!
"To be fully alive is to feel that everything is possible." - Eric Hoffer
paulius
Registered User
Posts: 17
Joined: Tue Jul 06, 2004 6:08 am

Post by paulius »

Very interesting.

However, I'm wondering about the installation process. It must be made by the administrator.

I think I'll try and rig the installation file to allow this kinds of things.
Paulius
espicom
Registered User
Posts: 17905
Joined: Wed Dec 22, 2004 1:14 am
Location: Woodstock, IL

Post by espicom »

The installation process can be cheated. Set up another directory for doing the installation from; it does not even have to be on the same machine, just has to have access to the MySQL server for the web server.

I'd start by adding the new forum's information to the "mass config" file. Then, on the setup machine, run the install, feeding it the information for the running forum. It will create the tables, then redirect you to the "real" forum, which will be ready to run.

The problem is that this won't work if the running forum has MODs, since the tables might not be right. The alternate way to "cheat" the install process is to maintain a "reference forum", which has no posts or defined forums, BUT has all the MODs in place. You then take an SQL backup of this forum, load the text into an editor, and do a global search-and-replace of "phpbb_" with the prefix that will be used for the new forum. There are about a half-dozen values in the config table that need to be modified, as well.

You then "restore" this backup to the server, and the new forum is up and running. This is the way I brought my three test forums up. Of course, it's also the way I bring up most new forums, so it was no change for me... :)
Jeff
Fixing 1016/1030/1034 Errors | (obsolete link) | MySQL 4.1/5.x Client Error | phpBBv2 Logo in ACP
Support requests via PM are ignored!
"To be fully alive is to feel that everything is possible." - Eric Hoffer
paulius
Registered User
Posts: 17
Joined: Tue Jul 06, 2004 6:08 am

Post by paulius »

So, in fact, I just need to hide the installation's form MySQL connection settings, and simply rig the script to create an "if" in the config file.

I don't have any mods... And the only mods I may ever have would be just some edited files.
Paulius
Quarterbore
Registered User
Posts: 81
Joined: Thu Sep 25, 2003 1:02 am

Post by Quarterbore »

I need to try this as well... I am sure that I understand this correctly but there is no shared user database as you have this listed... BUT that could be done by changing the user tables and post counts to all the same prefix such as to change /includes/constants.php

Code: Select all

// Table names
define('CONFIRM_TABLE', $table_prefix.'confirm');
define('AUTH_ACCESS_TABLE', $table_prefix.'auth_access');
define('CATEGORIES_TABLE', $table_prefix.'categories');
define('CONFIG_TABLE', $table_prefix.'config');
define('FORUMS_TABLE', $table_prefix.'forums');
define('POSTS_TABLE', $table_prefix.'posts');
define('POSTS_TEXT_TABLE', $table_prefix.'posts_text');
define('PRIVMSGS_IGNORE_TABLE', $table_prefix.'privmsgs_ignore');
define('PRUNE_TABLE', $table_prefix.'forum_prune');
define('SEARCH_TABLE', $table_prefix.'search_results');
define('SEARCH_WORD_TABLE', $table_prefix.'search_wordlist');
define('SEARCH_MATCH_TABLE', $table_prefix.'search_wordmatch');
define('TOPICS_TABLE', $table_prefix.'topics');
define('TOPICS_WATCH_TABLE', $table_prefix.'topics_watch');
define('VOTE_DESC_TABLE', $table_prefix.'vote_desc');
define('VOTE_RESULTS_TABLE', $table_prefix.'vote_results');
define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');
// Tables that will be shared
define('BANLIST_TABLE', 'phpbb_banlist');
define('DISALLOW_TABLE', 'phpbb_disallow');
define('GROUPS_TABLE', 'phpbb_groups');
define('PRIVMSGS_TABLE', 'phpbb_privmsgs');
define('PRIVMSGS_TEXT_TABLE', 'phpbb_privmsgs_text');
define('RANKS_TABLE', 'phpbb_ranks');
define('SESSIONS_TABLE', 'phpbb_sessions');
define('SMILIES_TABLE', 'phpbb_smilies');
define('THEMES_TABLE', 'phpbb_themes');
define('THEMES_NAME_TABLE', 'phpbb_themes_name');
define('USER_GROUP_TABLE', 'phpbb_user_group');
define('USERS_TABLE', 'phpbb_users');
define('WORDS_TABLE', 'phpbb_words');

With the assumption that phpbb_ would be the master board and all others would be slave to that user database... Note, this code is from here somewhere but I couldn't find the link so I pulled it from one of my forums where I had set it up to share user info! $table_prefix is a variable based on the CONFIG settings while phpbb_ does not change regardless to which forum you enter or post at.
espicom
Registered User
Posts: 17905
Joined: Wed Dec 22, 2004 1:14 am
Location: Woodstock, IL

Post by espicom »

Yes, if you force the define of certain tables to a single prefix in includes/constants.php, those tables would be shared.
Jeff
Fixing 1016/1030/1034 Errors | (obsolete link) | MySQL 4.1/5.x Client Error | phpBBv2 Logo in ACP
Support requests via PM are ignored!
"To be fully alive is to feel that everything is possible." - Eric Hoffer
Quarterbore
Registered User
Posts: 81
Joined: Thu Sep 25, 2003 1:02 am

Post by Quarterbore »

I was playing with your code above a little and I am curious if your example is really a single instance of phpBB? I ask as most subdomains are actually coded as...

domain.com - /domain
subdomain1.domain.com - /domain/subdomain1
subdomain1.domain.com - /domain/subdomain2

Can you please advise how this works for you and what you have uploaded?

as an aside, I took your idea and posted it as a mod request here:

http://www.phpbb.com/phpBB/viewtopic.php?t=279631

The big problem I see with my request is that it would be very difficult to post a link in one forum that links to a different forum on a different table prefix. There is a link to my site where I would love to use a single instance oh phpBB but still have seperate forums via different prefixes.

Here is my site http://www.lathetalk.com
Last edited by Quarterbore on Thu Apr 07, 2005 7:27 pm, edited 1 time in total.
espicom
Registered User
Posts: 17905
Joined: Wed Dec 22, 2004 1:14 am
Location: Woodstock, IL

Post by espicom »

On my system, there is one directory tree, but I have configured 3 subdomains to point to it:

http://test1.cruftware.com
http://test2.cruftware.com
http://test3.cruftware.com

This is using apache's IP-based virtual hosts, but it can work the same with name-based virtual hosts. Or, you can have one master directory, and use symbolic links to make the files appear to be in other directories (this last one only applies to Linux/Unix hosts).

Your example is name-based virtual hosting, but you can still point the names at a common directory. The use of subdirectories off of a main directory is to accomodate those who can't do HTTP 1.1 protocol... which is mainly spambots, nowadays... :)
Jeff
Fixing 1016/1030/1034 Errors | (obsolete link) | MySQL 4.1/5.x Client Error | phpBBv2 Logo in ACP
Support requests via PM are ignored!
"To be fully alive is to feel that everything is possible." - Eric Hoffer
nurhendra
Registered User
Posts: 144
Joined: Mon Feb 28, 2005 5:03 pm
Location: Jakarta

Post by nurhendra »

For single script to multi forum, you were using different table prefixes to differentiate forums. Wouldn't it be easier to have one table prefix but different database? This way, you can install phpBB with one database, then just duplicate the database to something else.

The config.php trick was great, and your logo mod is sure helpful to this single script>multi forum solution.
espicom
Registered User
Posts: 17905
Joined: Wed Dec 22, 2004 1:14 am
Location: Woodstock, IL

Post by espicom »

Wouldn't it be easier to have one table prefix but different database?


Not for me - Personally, I think it is a bad idea to use the default prefix with PHPBB, because anyone can guess what it is, so a script kiddie has one less thing to figure out when they want to zap a board. If they can figure out a way to "restore" an SQL file to add admin users to phpbb_users, but your table is myforum_users, it won't work...

Also, we like to have tables that relate to the group controlling the forums. If, say, the ACLU came to us to host a PHPBB for them (like THAT would ever happen!), their table prefix would be "aclu_bbs_", so we could remember where they were. :)

The beauty of the config file is that they don't have to share a database OR a prefix.
Jeff
Fixing 1016/1030/1034 Errors | (obsolete link) | MySQL 4.1/5.x Client Error | phpBBv2 Logo in ACP
Support requests via PM are ignored!
"To be fully alive is to feel that everything is possible." - Eric Hoffer
Locked

Return to “2.0.x Support Forum”