Change subdomain environment variables?


#1

I’m trying to use bugzilla on my VPS with a different database depending on which subdomain is used. I’m following the instructions here: Multiple Bugzilla databases with a single installation

I’m not quite sure where to put the code at the bottom though. I searched around and found this: Configure Apache on Debian or Ubuntu

However my /etc/apache2 directory doesn’t have any configuration files in it other than javascript-common.conf under a “conf.d” directory.

Can anyone help me understand where I’d go to do this? For example, say I want bc.mysite.com to change the environment variable PROJECT=bc.


#2

The page on the wiki you’re looking at is for configuring a web server on a DreamCompute instance. It does not apply to DreamHost VPS; do not try to follow its directions on your VPS!

Setting environment variables on DreamHost VPS will be a bit tricky, as suexec (which is used when executing files in your web directory) doesn’t pass through most environment variables. Your cleanest option may be to maintain two separate install directories; failing that, you may want to consider editing the configuration script for Bugzilla to be conditional on the domain being accessed, which can be read from the “HTTP_HOST” environment variable.


#3

[quote=“Andrew_F, post:2, topic:62775”]you may want to consider editing the configuration script for Bugzilla to be conditional on the domain being accessed, which can be read from the “HTTP_HOST” environment variable.
[/quote]

Thanks! That’s a good idea. I don’t have a lot of php experience but I could probably figure that out :slight_smile:


#4

This might be a dumb follow-up question, but isn’t HTTP_HOST going to basically be wherever bugzilla is installed, thus making multiple installs the only real solution?


#5

HTTP_HOST is the domain name that was used to make the active request. You said that you’d be setting up multiple installs on different subdomains - if that’s the case, HTTP_HOST will be set to whatever subdomain the incoming request was for.

Also, mind that Bugzilla is Perl, not PHP. :slight_smile:


#6

Thanks for the clarification! I thought there was a way to have one main codebase installed and different configurations linked to different databases based on the subdomain.

I think some of this setup may be over my head, and since I’m only going to have a couple projects running at a time I will go with separate installs. Much easier for me to understand that way :slight_smile: