[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Web applications specific issues



This one time, at band camp, sean finney said:
> virtual hosting will be a fairly complicated thing to approach.  most
> applications *do* work in such an environment, but it involves tweaking
> of configuration files in a non-intuitive way.  for example, with a php
> app, you can do something like this in your config.php:
> 
> <?php
> if($_GLOBALS['HTTP_SERVERNAME'] == "onehostname.com") {
> // ^ or whatever that variable is, i forget it off the top of my head
> 	$dbuser="foo"
> 	$dbpass="bar"
> } else {
> 	$dbuser="far"
> 	$dbpass="sar"
> }

The php guy where I work has taken to making config.php, which does
roughly

if($_GLOBALS['HTTP_SERVERNAME'] == "hostone.com" {
      include hostone.com.config.php
} elsif ($_GLOBALS['HTTP_SERVERNAME'] == "hosttwo.com" {
  ....
}

Which makes life a lot easier for vhost setups - that way you can set
the basename and so forth independantly of the actual install.
-- 
 -----------------------------------------------------------------
|   ,''`.					     Stephen Gran |
|  : :' :					 sgran@debian.org |
|  `. `'			Debian user, admin, and developer |
|    `-					    http://www.debian.org |
 -----------------------------------------------------------------

Attachment: pgpArXTJrET3d.pgp
Description: PGP signature


Reply to: