Hi,
Thanks for what looks like it's a great module! But I'm having a few problems installing, and I was wondering if you could please help.
Here's my set-up:
- Shared Server - Apache
- Drupal 5
- Drupal root location: templates/
- Drupal site location: templates/sites/goive.heebie.co.uk
- As for what's before templates/, I think my host works along the lines of user/www/ , so my Drupal root would be heebie/www/templates
Now, I've tried configuring my .htaccess file. Should this be in www/ or in www/templates?
This is what I've come up with:
#file access
RewriteRule ^\w+/(modules|misc|files|themes|sites)(.*)$ ./$1$2 [L]
RewriteRule ^/(modules|misc|files|themes|sites)(.*)$ ./$1$2 [L]
#special php scripts
RewriteRule ^\w+/(update.php|install.php|index.php)(.*)$ ./$1$2 [L,QSA]
#site sub-section
RewriteCond %{REQUEST_FILENAME} ^/templates/site/.*
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^\w+(/)?(.*)$ index.php?q=$2 [L,QSA]
and currently it's placed in www/ . It doesn't work, ie http://goive.heebie.co.uk/site/mysite returns a Drupal 404.
That's probably because I haven't yet created this symlink yet:
% cd /var/www/drupal
% ln -s . site
Where do I apply this? www/ or www/templates? I presume www/ if this is where I have put www/ (as I have), and var/www/drupal should be www/templates? I have no folder called 'var'.
Next, settings.php . I don't really understand the whole goive.heebie.co.uk.site folder - what is this, how does it work and why is it needed? This is the code that your module generated for me:
$matches = FALSE;
if (preg_match("|goive.heebie.co.uk|",$_SERVER["HTTP_HOST"])
&& preg_match("|^/site/(\w+)|",request_uri(), $matches)
&& $matches)
{
$my_site_base = $matches[1];
$db_prefix = "";
$base_url = "http://goive.heebie.co.uk/site/". $my_site_base .""; // NO trailing slash!
$db_url = "mysql://heebie_heebie:DATABASE_PASSWORD@localhost/heebie_goive";
///This assumes you have a ./files directory in your base drupal directory
$conf = array(
"file_directory_path" => "files/".$my_site_base,
);
}
Everything seems OK there.
Finally:
3. Any modules required for profile selections must be installed on
BOTH the main site's modules directory AND the subsidiary site module
directory (a symlink will do just fine);
the former in order to install, the latter in order to run.
I do plan to use installation profiles, so this is relevant. What exactly is the main site and the subsidiary site in this case? Is it templates/modules and templates/sites/goive.heebie.co.uk/modules ? So what would my symlink look like? And in case I want to add modules to just some of the user-created sites, what symlinks would I use then?
I understand this is a lot, and I thank you in advance for your patience and co-operation. If I manage to get everything working, I'll see what I can do about creating some documentation, to save you some time and hassle in the future! It's the least I can do.....
Regards,
heebie.
Comments
Comment #1
B747 CreditAttribution: B747 commentedUPDATE: I did ask my webhost to create a symlink, and looking at my file manager, it looks like templates/site has been created. In that folder is a Drupal installation which mirrors /templates , so that templates/site/site/site can go on ad infinitum. Not sure if this is right or not!
Comment #2
schuyler1d CreditAttribution: schuyler1d commentedthe symlink sounds correct.
1. Can you confirm that the templates/ directory is the one with the index.php file from drupal (and the rest of the Drupal core files)?
2. Try adding the line:
var_dump(realpath('.'));
to the settings.php file (outside of the conditional). That way you can confirm that the file is getting called, and you can get the exact path that you need to put in the htaccess file line:
RewriteCond %{REQUEST_FILENAME} ^/templates/site/.*
My guess is that this line should read
... ^/www/templates/site/.*
but we'll know when you get the output from the realpath('.') command.3. WRT the profiles and the modules directory, it might be easier just to copy all the modules. The simplest solution is to put all the modules in the sites/all/modules directory, and then everything will just work. If you want modules in a specific group of sub-sites, then you'll need to make custom directories for them. something like sites/goive.heebie.co.uk.site.mysite and put the modules (and themes) specific to that site in sites/goive.heebie.co.uk.site.mysite/modules.
Comment #3
B747 CreditAttribution: B747 commented1. You have confirmation
2. What do you mean by "outside of the conditional"?
3. To save space I would probably like to use a symlink here. How would I do this?
heebie.
Comment #4
schuyler1d CreditAttribution: schuyler1d commented2. just above the line
$matches = FALSE;
will do. (FYI 'conditional' refers to 'if...' statements)3. Make a modules symlink from or into the default directory. But as I continued, if you put your modules in the 'sites/all' directory, you don't need a symlink.
Comment #5
B747 CreditAttribution: B747 commentedOK. Done. I get the following now when trying to access:
I guess that first line is the most important...
My point about the modules symlink is that I want to fine tune which sites have which modules installed, and to save space, I want to use a synlink.
Again, thanks for your help...
Comment #6
schuyler1d CreditAttribution: schuyler1d commentedgreat, so comment that var_dump line out (put a '//' in front of it).
Then replace your line .htaccess:
RewriteCond %{REQUEST_FILENAME} ^/templates/site/.*
with this:
RewriteCond %{REQUEST_FILENAME} ^/home/heebie/public_html/templates/site/.*
and see if it works.
Comment #7
B747 CreditAttribution: B747 commentedNo, I still get a 404.
http://goive.heebie.co.uk/site/mysite
Comment #8
schuyler1d CreditAttribution: schuyler1d commentedWell I don't. I get:
which suggests that you've put your own modules in the root /modules directory. You shouldn't do this--it will make upgrading drupal much more difficult, not to mention that you broke the site. Move the devel module and any others that you downloaded separate from core into the /sites/*/modules directory, where the '*' represents whichever sites you want it installed in.
Comment #9
B747 CreditAttribution: B747 commentedI've done everything you said, but I still get a 404. What do you get now?
Comment #10
schuyler1d CreditAttribution: schuyler1d commentedhmm. I just realized you're not changing the database url or prefix based on the site.
What are the variables you've setup in the multisite_manager admin settings?
At least one of the lines starting "$db_url = ..." and "$db_prefix = ..." should be using the variable $my_site_base.
Comment #11
B747 CreditAttribution: B747 commentedHmmm. Ever I since I moved those modules no settings pages are appearing for them. They appear ticked as before in admin/build/modules , but I can't configure any of them, including MSM. Any ideas?
Comment #12
schuyler1d CreditAttribution: schuyler1d commentedrun the update.php script. Your system table has the old locations for the modules.
Comment #13
B747 CreditAttribution: B747 commentedSo everything is back to normal now. The db settings have been left as default, ie {shortname}_ as the db prefix. I still get a 404...
Comment #14
schuyler1d CreditAttribution: schuyler1d commentedWell that's the information I needed to know in order to tell you to replace the line:
$db_prefix = "";
with this:
$db_prefix = $my_site_base . "_";
For a possible bug, can you save your admin settings for multisite (just click save), and see if the page for the settings.php code still has a $db_prefix line like you had?
Comment #15
B747 CreditAttribution: B747 commentedOK. Changed line
$db_prefix = "";
to$db_prefix = $my_site_base . "_";
in goive.heebie.co.uk.site settings.php .I click save in admin/settings/multisite_manager and go onto settings.php help tab, this line is shown:
$db_prefix = "". $my_site_base ."_";
, slightly different than the one you gave meComment #16
schuyler1d CreditAttribution: schuyler1d commentedBoth are correct. so you can leave it. The current error I get when I get to your site is:
which suggests you may have moved the user module into /sites/all/modules instead of its core location in /modules
Comment #17
B747 CreditAttribution: B747 commentedMust be some other reason - attached is a list of all the modules I have moved into sites/all/modules.
Comment #18
schuyler1d CreditAttribution: schuyler1d commentedhonestly, that problem is not related to multisite_manager. You need to have a working instance of drupal before we can continue.
Comment #19
B747 CreditAttribution: B747 commentedI've disabled devel. Any changes?
I don't see any errors anywhere else apart from the ones you mentioned which are only showing on pages related to multisite_manager.
Comment #20
schuyler1d CreditAttribution: schuyler1d commentedhmm. can you list the contents of each directory in ./sites ?
Also, try putting the line:
var_dump(realpath('.'));
just under the
$db_prefix = ...
line in the settings.php.Comment #21
B747 CreditAttribution: B747 commentedThe image in post #17 contains a list of all the modules under sites/all - goive.heebie.co.uk and goive.heebie.co.uk.site just have settings.php under them.
Done as you asked, now get:
on http://goive.heebie.co.uk/site/mysite
Comment #22
schuyler1d CreditAttribution: schuyler1d commentedThat first line:
string(34) "/home/heebie/public_html/templates"
should be:
string(34) "/home/heebie/public_html/templates/site"
which means the symlink isn't working/present, and/or the .htaccess file isn't getting processed properly.
I notice that you said in the original that your htaccess file "is placed in /www"--that 's wrong. the .htaccess file needs to be in your templates directory--with that code on top of the .htaccess file that comes with drupal.
Comment #23
B747 CreditAttribution: B747 commentedOK. Added the following to the top of the .htaccess in /templates:
No luck (everything the same). I also changed
RewriteCond %{REQUEST_FILENAME} ^/templates/site/.*
toRewriteCond %{REQUEST_FILENAME} ^/site/.*
but still no luck. Have left it as version at top of this comment.So, is it the symlink then? My current set-up with regards to that is described in comment #1
Comment #24
schuyler1d CreditAttribution: schuyler1d commentedno, see comment #6
Comment #25
B747 CreditAttribution: B747 commentedRight you are. Well, I've changed it accordingly and still no luck.
Comment #26
schuyler1d CreditAttribution: schuyler1d commentedi'm stuck. it looks like clean urls is working, so the Rewrite rules should be processing in theory.
Maybe your first site "mysite" didn't get created properly. Try creating another one, perhaps. Try changing the var_dump line to:
var_dump(realpath('.'),$db_prefix);
and see if those tables are actually in the database (if you know how to look).
Comment #27
B747 CreditAttribution: B747 commentedI created another one but still no luck. Could it have something to do with the fact that I have Clean URLs enabled on my site but msm is not set up to support Clean URLs?
And no, i don't know how to see if those tables are actually in the database.
Comment #28
schuyler1d CreditAttribution: schuyler1d commentedMSM supports clean urls (that's the purpose of the weird htaccess rules). I have it working on all my production sites.
Try adding the var_dump line mentioned in #27. Maybe there's some difference in how Apache is configured. I'm stumped. If you want to zip the contents of your template directory (minus the passwords in settings.php) and send it to me, I could take a look.
Comment #29
schuyler1d CreditAttribution: schuyler1d commented(gets tarball, thanks)
Ah, I see your problem. in the sites/goive.heebie.co.uk.site/settings.php file, you put the MSM code on top, but further down (lines 110,111,132) those settings get erased with the values from the main site.
Delete those lines (or put my code at the end of the file).
If it works (fingers crossed!), then remove the
var_dump
line.Comment #30
B747 CreditAttribution: B747 commentedI've done what you said... now it's still a 404 but a different one! http://goive.heebie.co.uk/site/mysite
Adding
var_dump(realpath('.'));
gives: string(34) "/home/heebie/public_html/templates"Same thing for a brand new created site.
Comment #31
B747 CreditAttribution: B747 commentedAny ideas?
Comment #32
B747 CreditAttribution: B747 commentedNo?
Comment #33
schuyler1d CreditAttribution: schuyler1d commentednot at the moment. Y'know, I've got a day job, too :-)