I have drupal installed on Universal Server on my PC.

I have a working demo site as the default site.

I want to make a second site, so decided to try setting it up for two sites.

I now have \sites\localhost.demo1\settings.php
and
\sites\localhost.demo2\settings.php

..which I understood was what was required.

http://localhost/demo1 now shows a drupal error page about 'unsupported database type' in the non-existent \sites\default\settings.php.

I've obviously missed a step somewhere. I'm sure I'm being stupid about ssomething, but I'm getting more confused the more I read as there seem to be lots of different ways of doing it.
I'd like a method that allows somone external to access my 2 sites using http://ip-address/demo1

Thanks!

Comments

WorldFallz’s picture

Are you using apache? Did you configure an apache VirtualHost for the site in the httpd.conf file? I used the following virtual hosts in my httpd.conf:

<VirtualHost *>
  DocumentRoot c:/wamp/www
  ServerName localhost
</VirtualHost>

<VirtualHost *>
  DocumentRoot c:/wamp/www
  ServerName dev1
</VirtualHost>

<VirtualHost *>
  DocumentRoot c:/wamp/www
  ServerName dev2
</VirtualHost>

<VirtualHost *>
  DocumentRoot c:/wamp/www
  ServerName dev3
</VirtualHost>

which gave me:

Notice that all the docroots point to the root drupal install, not the directly to the subsites. That's the key-- drupal does the redirecting for the subsites, not apache.

Also, i didn't use "localhost" in my directory names, not sure if that makes a diff.

WorldFallz’s picture

actually... I think you may be using an unsupported platform. That "unsupported database type" error message bothered me and when i googled "universal server" I found what appears to be an application/db/web server. Currently, drupal only supports mySQL and PostgreSQL.

ctsrutland’s picture

Sorry.. my brain's having a bad day.. I meant to type "uniform server".

my apache httpd.conf has this section:

<VirtualHost *>
ServerName demo1
DocumentRoot /www/
</VirtualHost>

my settings.php is in /sites/localhost.demo1/settings.php

http://localhost/demo1 gives the following - clearly drupal is not picking up my new settings.php and is trying to use the default sire folder which doesn't exist any more.:

Warning: include_once(./sites/default/settings.php) [function.include-once]: failed to open stream: No such file or directory in W:\www\includes\bootstrap.inc on line 243

[more errors edited out]

Unsupported database type

Should I need to change anything within settings.php? I haven't altered anything apart from changing the fodler name from default.

ctsrutland’s picture

It seems to have started working now after another restart of apache.. I must have changed somethign else as well as I restarted it before.

I do appreciate your speedy help.. thank you!

dman’s picture

You are mixing two concepts here.

If you are trying for subdirectory-based multisite, then you don't do virtualhost type configs, and vice versa.

ServerName demo1
won't work unless you also have a DNS or HOSTS hack on your machine to point at it, and even then, 'demo1' is a different hostname from 'localhost.demo1'. I suspect you haven't got as far as wildcard DNS (and even then it's be backwards)

Try starting from the top again, following the multisite recipes - but only one of them, not mixing and matching.

If local virtualhosts are beyond you right now, you may find Apache Aliases easier.

Alias /demo1 W:\www
should let you visit
http://localhost/demo1
and see a new site with the configs from
W:\www\sites\localhost.demo1\settings.php

If you are serious about

<VirtualHost *>
ServerName demo1
DocumentRoot /www/
</VirtualHost>

however, and have already set up to the point where you can get any response at all out of
http://demo1/
(because that's what the VirtualHost is saying)
then your config file need only be
W:\www\sites\demo1\settings.php

... and, I might as well tell you in the end ...
edit
c:\windows*\system32\drivers\etc\hosts
and add the line
127.0.0.1 demo1
to make your Apache VirtualHost actually work.

Repeat as needed.
This is mostly Apache config stuff.

.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/

ctsrutland’s picture

Thanks all.

It isn't working after all now. I can do it with virtual hosts and editing the hosts file.. but that won't work for someone externally will it?

Otherwise, a site configured with sites\default\settings.php works fine. But i'd like to be able to use http://localhost/demo1, or http://ip-address/demo1 externally

I now have the default apache httpd.conf file which just has:

ServerName localhost:80
DocumentRoot /www

If I rename the sites\default folder to any of:
sites\demo1
sites\localhost.demo1
sites\127.0.0.1.demo1

and try http://localhost/demo1

Then I get the error page I first posted from drupal starting:

Warning: include_once(./sites/default/settings.php) [function.include-once]: failed to open stream: No such file or directory in W:\www\includes\bootstrap.inc on line 243

..so drupal isn't finding my new site folder.

I tried several variation on the Alias example suggested above without success..

As you say it must be an Apache configuration problem.

dman’s picture

You are not going to be able to get multisites and subdirectories available externally without either an actual servername or a truckload of fiddling (either some file duplication or serious router twisting)

Maybe you should start putting your stuff on a real host.

Or, perhaps you should stop playing with subdirectories and consider alternative ports instead.
That's better in the long term for building a site with links that will work once moved, and the apache configs are pretty straightforward. You'll have to tweak your router port-forwarding, but that's about it.

See the apache docs, get another port open and serving pages. Then read the instructions in settings.php again.

... actually ... that may require a bit of magic also ... yeah, you'd still have to duplicate a settings.php file so you can access it locally and remotely at the same time...

Nah, it's too hard to explain. Get yourself a hosted account with a domain name.

.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/

ctsrutland’s picture

OK, thanks.. but now I'm confused because I thought it was an advertised feature of drupal that it is easy to have multiple sites in subdirectories without a truckload of fiddling. I thought that's what the purposes of the subdirectories under 'sites' was?

All the documentation tells me that if I set up ...\sites\test-site, then I should be able to access it by going to http://ip-address/test-site .. have I misunderstood that?

Oh well...

dman’s picture

I may have mis-spoke.
You can have IP-Address + subdirectories with not too much trouble.
Apache Aliases or symlinks will do it.

But your idea of doing it with
ServerName demo1
is incompatible with wanting external access ... without much network-fu.

Virtual Hosts is one way to go.
Subdirectories is another.
They are different. Not incompatible (sometimes I do both at once for arcane reasons)

The documentation does appear to skip over step 3 ... possibly because it's technically server-specific.

# Edit the appropriate settings in your web server to point to the Drupal root directory

If you want http://ip-address/test-site to respond with Drupal in Apache, you might add

Alias /test-site "w:\www"

to the host config that's answering your IP ... not your name-based virtual.

.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/

ctsrutland’s picture

Thanks for your help - I'll have another look at it.