Jump to content
raydale

Problems setting up multisite

Recommended Posts

Hi guys, I'm having problems setting up a multisite instance. I have followed the instructions here: http://processwire.c...i-site-support/ and can access my main site fine.

However, my sub site located in site-[domain] throws this error when visiting its domain name (I have changed the http root - just in case):

Error Exception: DB connect error 2005 - Unknown MySQL server host 'Config' (0) ([root]/wire/core/ProcessWire.php line 95)

My error logs show:

? http://www.ray-dale.com/?/ Error Exception: Unknown column 'fieldgroups_fields.data' in 'field list' (in [root]/wire/core/Database.php line 118)

Does anyone have any ideas?

Share this post


Link to post
Share on other sites

Apparently your db host is not well set in the config.php file. You have it set to "Config"?

Share this post


Link to post
Share on other sites

Thanks for the response Diogo. Hmm, the config is setup fine it seems. I have the correct dbHost, dbName etc for the subsite.

Part of the recommended setup process in the instructions I link to involve actually installing the subsite as a normal seperate pw site first under a sub directory. This all worked fine with a separate database and site being setup under the temp directory as per the suggestion.

Share this post


Link to post
Share on other sites

What versions are you running? I think "fieldgroups_fields.data" was added at some point in 2.2.

Share this post


Link to post
Share on other sites

Hi Soma, I have just upgraded (the main site) to version 2.2.

Edit: I upgraded the main site to 2.2 last night before installing the new sub site (again v 2.2).

Share this post


Link to post
Share on other sites

I also have multisite installed in my server, and did a small test now. I was able to reproduce the message you get on the browser "Error Exception: DB connect error 2005 - Unknown MySQL server host 'Config' (1) (in /srv/www/diogoo.com/public_html/wire/core/ProcessWire.php line 95)" by mistyping the name of the subsite folder on the "index.config.php" file.

make sure that you have it like this:

 'domain.com' => 'folder-name',

the folder name should be something like "site-whatever"

EDIT: I suspect the error log is older than this. Can you check the date?

Share this post


Link to post
Share on other sites

Thanks for testing Diogo.

Ah yes, the error log is too old to be relevant. So, that leaves the error exception shown in the browser: Error Exception: DB connect error 2005 - Unknown MySQL server host 'Config' (0) (in /home/raydale/public_html/wire/core/ProcessWire.php line 95)

I have setup 'site-foldername' correctly in the index.config.php file it seems.

I also get 'This error message was shown because Superuser has never logged in. Error has been logged.' underneath the error exception message, but I haven't had any error messages logged. Not sure if this gives any more clues?

Share this post


Link to post
Share on other sites
I have setup 'site-foldername' correctly in the index.config.php file it seems.

Still, it does look like the problem must be here. Somehow, the config is not pointing to the correct folder.

but I haven't had any error messages logged

This would be a consequence of the first problem. If PW doesn't know the way to the folder, it can't put any log there.

You said you set up 'site-foldername', that must be the problem. The folder must be called 'site-something', 'site-' must be part of the folder name. Do you have it like this?

EDIT: I even tested removing the "site-" part of the folder and also on the config, and it still works (@Ryan, is there any special reason for requiring this on the instructions? Or is it just for organizational purposes?)

Share this post


Link to post
Share on other sites

I'm sure you are right - I must be doing something wrong. Maybe I have missed something basic. My settings in the config file are:

'ajs-decorator.co.uk' => 'site-ajsdecorator',
'www.ajs-decorator.co.uk' => 'site-ajsdecorator',

I have a directory setup as: 'site-ajsdecorator'. In this directory is the 'site' directory as required.

I have also double checked that I have the latest v2.2 htaccess file (which I do).

Share this post


Link to post
Share on other sites

I have a directory setup as: 'site-ajsdecorator'. In this directory is the 'site' directory as required.

I've never used this multi site setup, but I think that's wrong. You don't need a "site" folder inside your "site-something" folder.

Share this post


Link to post
Share on other sites
You don't need a "site" folder inside your "site-something" folder.

Yep, that's the problem. Move all the content from this 'site' directory one level up, to the 'site-ajsdecorator' directory, and it should be fine.

Share this post


Link to post
Share on other sites

HAHA!!!

Thanks very much for your patience Diogo and Soma! It works now.

I have looked through the instructions again and it does clearly state 'Once installation has completed, move or rename the /tmp/site/ directory to a /site-name/ directory in your main ProcessWire installation'.

Of course being an idiot I scan read the steps and ended up just putting the 'site' folder INTO a 'site-name' directory. I hope this helps anyone else coming across this problem.

Thanks again guys.

  • Like 2

Share this post


Link to post
Share on other sites

EDIT: I even tested removing the "site-" part of the folder and also on the config, and it still works (@Ryan, is there any special reason for requiring this on the instructions? Or is it just for organizational purposes?)

I found this earlier testing combinations of directory naming structure in the index.config.php and thought I had messed something else up :-[ . I have reverted to using the 'site-something' naming convention for organisation, but I would still be interested to know if directories can be more 'loosely' named like this?

Share this post


Link to post
Share on other sites
(@Ryan, is there any special reason for requiring this on the instructions? Or is it just for organizational purposes?)

The "site-" at the beginning is required because the .htaccess file knows to block access to sensitive directories/files below all directories beginning with "site-". So while you could use a different naming structure, you'd have to make a lot of changes to your .htaccess file in order to make it secure.

  • Like 2

Share this post


Link to post
Share on other sites

Thanks Ryan, it's always good to know the 'why' as my education in PW continues.

Share this post


Link to post
Share on other sites

I think my post here was better suited for this topic. From all the examples I have seen, you cannot use sub-folders but just different domains and sub domains. Would that be correct?

Share this post


Link to post
Share on other sites

I think so, Rjay. This is only for different domains.

Share this post


Link to post
Share on other sites

Thanks diogo, it would be nice to have either option, but I could see how it could cause some problems. 

Share this post


Link to post
Share on other sites

Is it possible to set up the sub domain multisite on wamp?

Share this post


Link to post
Share on other sites

Hi Diogo,

Thanks for the quick response and link. I was still unable to get the subdomain to work properly. I think I will just do a new pw install on my local and export it to the live sub domain db when I am done. Sounds like it might be easier and quicker :) Thanks again.

After looking at the apache error log, it looks like it was looking for the subdomain folder within the wamp/www/ directory. Note sure how to get around that. 

I had also misunderstood the forwarding of the sub-domain as well and think this is only possible by creating a new dns record. I would be curious if any others have manged to set it up on a local environment. Or I could be completely over my head (which is more likely possible) :)

Edited by RJay

Share this post


Link to post
Share on other sites

Would really like to know if any was able to get option 1 here working with hostgator? I have set up everything perfectly, but for some reason it does not want to point the sub-domain.

Update!

After banging my head for a few days. To "point" a domain in most shared hosting accounts is to "park" a domain. Now that I feel dumber :), I hope someone else will find this useful. It works perfectly!

Edited by RJay
  • Like 2

Share this post


Link to post
Share on other sites

Would really like to know if any was able to get option 1 here working with hostgator? I have set up everything perfectly, but for some reason it does not want to point the sub-domain.

Update!

After banging my head for a few days. To "point" a domain in most shared hosting accounts is to "park" a domain. Now that I feel dumber :), I hope someone else will find this useful. It works perfectly!

thanks Rjay for this last update I had my second domain as an add On Domain and it didn't work, now the second domain is working as a parked one.

I still have to "hide" the site-otherdomainname folder if you go to the http://site.com/site-otherdomainname you can see the contents, so probably you will have the same content indexed twice. Doing a 301 redirect for that folder, on the .htaccess it will get the wrong path for the content (css,js) of site-otherdomainname.


Redirect 301 /site-otherdomainname http://site-otherdomainname 

On the topic of parked and addOnDomains

This didn't work for me:

On my server's pulbic_html folder I have two folders:
site
site-otherdomainname
 
Then also on the public_html folder I have this pWire files:
.htaccess (no 301 redirects at the moment for this www.otherdomainname.com )
index.php
index.config.php

 'otherdomainname.com' => 'site-otherdomainname',
 'www.otherdomainname.com' => 'site-otherdomainname',
        /*
         * Default for all others (typically /site/)
          *
         */
        '*' => 'site',
 
Then I have two databases one for the main site domain, this one is working and other for the site-otherdomainname on this lasts domain folder I have the config.php file with the same sql user but different databases.
$config->dbHost = 'localhost';
$config->dbName = 'serverusername_otherdomainname';
$config->dbUser = 'serverusername_aamulti';
$config->dbPass = 'dbpassword';
$config->dbPort = '3306';
 
This otherdomainname.com was added as a add On Domain on cPanel, it outputs a 500 error.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...