I'm setting up multisites right now (trying to) and I have a template database already created based off and configured by the modules in sites/default/modules , I create a subdomain so ... dogs.example.com which creates the folder public_html/dogs . Now I'm still trying to figure out how this all connects but what is the correct symlinks to run here to get sites/dogs.example.com connected in with the domain name which is resolving to public_html/dogs

Each individual site starts off with a standard user/1 and user/2 and configured modules which is the reason for the template database but we want to maintain this codebase so we can add modules to every site later and what not.

I'm get a 500 error when I symlink it, right now I'm not using symlink in php i'm using "exec" in php because my host won't allow us to use symlink function. I'm getting a whitescreen when I run that php file which should mean that it's symlinking correctly. If someone could just tell me what I need to be connecting here (I understand settings.php already) to get this to work that would be much appreciated. I may even throw some paypal money your way, this is kind of important.

Comments

anthonylicari’s picture

anthonylicari_ I'm setting up multisites right now (trying to) and I have a template database already created based off and configured by the modules in sites/default/modules , I create a subdomain so ... dogs.example.com which creates the folder public_html/dogs . Now I'm still trying to figure out how this all connects but what is the correct symlinks to run here to get sites/dogs.example.com connected in with the domain name which is resolving to public_html/dogs
josh_b- you would link public_html/dogs to public_html/drupal
josh_b- you have one drupal folder that is the document root for all your drupal domains
josh_b- And just tell Apache to use that same folder for your document root (don't need symbolic links)
josh_b- and then create a dogs.example.com directory in your sites folder and it has (at a minimum) settings.php which tells it which database to use
josh_b- and can have modules and themes directories as well
josh_b- I also set the "files" directory to be sites/dogs.example.com/files so that the sites directories are more modularally transportable

I have installed drupal in public_html , I did not realize there was a "drupal" folder

___
Anthony Licari Dot Com

cog.rusty’s picture

So, you have:
- Drupal installed in public_html
- http://example.com pointing to public_html
- http://dogs.example.com pointing to public_html/dogs

First, you need to make dogs.example.com to point also to public_html, just like the first site.
- Go to public_html
- Delete the dogs subdirectory
- Create a symlink in its place, pointing "here" (inside public_html), and named dogs

ln -s . dogs

Now all requests for any of your sites will go to Drupal's index.php file, and Drupal will compare the request with the names of the directories which you have created under /sites, and will serve the requested site. So, you must have:

public_html/sites/example.com/settings.php (or leave it to "default" if you prefer)
public_html/sites/dogs.example.com/settings.php

If you have put your modules and themes under sites/default then they will be visible only by the site which uses sites/default (if any). To make them visible to all sites you have to put them under sites/all.

I hope the picture was clear enough.

Now about the template database, if it is OK then effectively you have both sites already installed -- you just need to load it in their databases and enter the $db_url information in their settings.php files.

anthonylicari’s picture

When it came down to it I thought I was just retarded and was making this harder than it was. I have everything setup right (created an auto script to do all this based on user submitted variables) the only problem is, is that I'm on a shared host. That's why my symlinks weren't working. I don't have access to do so. This will all change with my new dedicated server. Anyway thanks for the response, much better detail than most the stuff I had found before.

___
Anthony Licari Dot Com

Quint’s picture

Actually, you can do it without a symlink if you add a CNAME record into you nameserver records under DNS. I CNAME'd a test domain on a different host to point to a Drupal domain and it worked fine.

Edit your DNS zone under WHM, or get your provider to add it for you. Like this:

dogs.example.com 14400 CNAME example.com. (it needs the dot at the end)

Quint

cog.rusty’s picture

It is weird though. Any shared host that I have heard of lets you do at least a php symlink(".", ""dogs");

I guess you checked other reasons that your scripts didn't create a symlink, for example:
- that the old "dogs" directory had been deleted and was not standing in the way, and
- that your public_html was temporarily set to 777 so that apache could write the symlink.

Michael-IDA’s picture

"- that your public_html was temporarily set to 777 so that apache could write the symlink."

Truth in advertising, as I've only run across references to this and I'm typing from memory, but if your server has PHPSuExec installed, you would need 755 permission and it would barf on 777.

Sam
inet-design.com, Managed hosting for Drupal

Drupal Hosting

NIH Cancer Study: Supplemention with both vitamins and fenbendazole exhibited significant (P = 0.009) inhibition of tumor growth.

cog.rusty’s picture

It is true that it depends on the server configuration. In my current one, public_html is 750 and I can write fine without changing it. In my previous one I needed to make it 777 for a while.

So, the point was to make sure that the symlink could be written one way or another.

Michael-IDA’s picture

While playing random problem bingo with one of my hosting firms....

If one of your multisite domains goes dark after a server upgrade or relocation, check that the hosting firm did a full proper copy or restore and didn't inadvertently delete your Symlinks...

The guilty shall remain nameless (unless of course you ping my domain).

Sam

Edit: We no long use that hosting firm. The new one is better, but not great.

Drupal Hosting

NIH Cancer Study: Supplemention with both vitamins and fenbendazole exhibited significant (P = 0.009) inhibition of tumor growth.