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.

CommentFileSizeAuthor
#17 modules.png275.61 KBB747
#7 cp.png27.32 KBB747
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

B747’s picture

UPDATE: 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!

schuyler1d’s picture

the 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.

B747’s picture

1. 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.

schuyler1d’s picture

2. 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.

B747’s picture

OK. Done. I get the following now when trying to access:

string(34) "/home/heebie/public_html/templates"
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/heebie/public_html/templates/sites/goive.heebie.co.uk.site/settings.php:4) in /home/heebie/public_html/templates/includes/bootstrap.inc on line 899

Warning: Cannot modify header information - headers already sent by (output started at /home/heebie/public_html/templates/sites/goive.heebie.co.uk.site/settings.php:4) in /home/heebie/public_html/templates/includes/bootstrap.inc on line 531

Warning: Cannot modify header information - headers already sent by (output started at /home/heebie/public_html/templates/sites/goive.heebie.co.uk.site/settings.php:4) in /home/heebie/public_html/templates/includes/bootstrap.inc on line 532

Warning: Cannot modify header information - headers already sent by (output started at /home/heebie/public_html/templates/sites/goive.heebie.co.uk.site/settings.php:4) in /home/heebie/public_html/templates/includes/bootstrap.inc on line 533

Warning: Cannot modify header information - headers already sent by (output started at /home/heebie/public_html/templates/sites/goive.heebie.co.uk.site/settings.php:4) in /home/heebie/public_html/templates/includes/bootstrap.inc on line 534

Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/heebie/public_html/templates/includes/module.inc on line 217

Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/heebie/public_html/templates/includes/module.inc on line 217

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...

schuyler1d’s picture

great, 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.

B747’s picture

FileSize
27.32 KB
schuyler1d’s picture

Well I don't. I get:

Fatal error: Call to undefined function user_access() in /home/heebie/public_html/templates/modules/devel/devel.module on line 243

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.

B747’s picture

I've done everything you said, but I still get a 404. What do you get now?

schuyler1d’s picture

hmm. 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.

B747’s picture

Hmmm. 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?

schuyler1d’s picture

run the update.php script. Your system table has the old locations for the modules.

B747’s picture

So 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...

schuyler1d’s picture

Well 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?

B747’s picture

OK. 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 me

schuyler1d’s picture

Both are correct. so you can leave it. The current error I get when I get to your site is:

Fatal error: Call to undefined function user_access() in /home/heebie/public_html/templates/sites/all/modules/devel/devel.module on line 243

which suggests you may have moved the user module into /sites/all/modules instead of its core location in /modules

B747’s picture

FileSize
275.61 KB

Must be some other reason - attached is a list of all the modules I have moved into sites/all/modules.

schuyler1d’s picture

honestly, that problem is not related to multisite_manager. You need to have a working instance of drupal before we can continue.

B747’s picture

I'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.

schuyler1d’s picture

hmm. 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.

B747’s picture

The 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:

string(34) "/home/heebie/public_html/templates"
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/heebie/public_html/templates/sites/goive.heebie.co.uk.site/settings.php:12) in /home/heebie/public_html/templates/includes/bootstrap.inc on line 899

Warning: Cannot modify header information - headers already sent by (output started at /home/heebie/public_html/templates/sites/goive.heebie.co.uk.site/settings.php:12) in /home/heebie/public_html/templates/includes/bootstrap.inc on line 531

Warning: Cannot modify header information - headers already sent by (output started at /home/heebie/public_html/templates/sites/goive.heebie.co.uk.site/settings.php:12) in /home/heebie/public_html/templates/includes/bootstrap.inc on line 532

Warning: Cannot modify header information - headers already sent by (output started at /home/heebie/public_html/templates/sites/goive.heebie.co.uk.site/settings.php:12) in /home/heebie/public_html/templates/includes/bootstrap.inc on line 533

Warning: Cannot modify header information - headers already sent by (output started at /home/heebie/public_html/templates/sites/goive.heebie.co.uk.site/settings.php:12) in /home/heebie/public_html/templates/includes/bootstrap.inc on line 534

Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/heebie/public_html/templates/includes/module.inc on line 217

Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/heebie/public_html/templates/includes/module.inc on line 217

on http://goive.heebie.co.uk/site/mysite

schuyler1d’s picture

That 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.

B747’s picture

OK. Added the following to the top of the .htaccess in /templates:

#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]

No luck (everything the same). I also changed RewriteCond %{REQUEST_FILENAME} ^/templates/site/.* to RewriteCond %{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

schuyler1d’s picture

no, see comment #6

B747’s picture

Right you are. Well, I've changed it accordingly and still no luck.

schuyler1d’s picture

i'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).

B747’s picture

I 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.

schuyler1d’s picture

MSM 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.

schuyler1d’s picture

(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.

B747’s picture

I'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.

B747’s picture

Any ideas?

B747’s picture

No?

schuyler1d’s picture

not at the moment. Y'know, I've got a day job, too :-)