title: Setting PHP variables in httpd.conf?
body: <p>I'd like to automatically change my database connection settings on a per-vhost basis, so that I don't have to edit any PHP code as it moves from staging to live and yet access different databases. This is on a single dedicated server.</p>
  
  <p>So I was wondering, can I set a PHP variable or constant in httpd.conf as part of the vhost definition that the site can then use to point itself to a testing database automatically?</p>
  
  <pre><code>$database = 'live';
  if (some staging environment variable is true) {
      $database = 'testing'; // and not live
  }
  </code></pre>
  
  <p>If this isn't possible, I guess in this case I can safely examine the hostname I'm running on to tell, but I'd like something a little less fragile</p>
  
  <p>Hope this makes sense</p>
  
  <p>many thanks</p>
  
  <p>Ian</p>