Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 809919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:48:14+00:00 2026-05-15T00:48:14+00:00

I have a web site with many virtual hosts and each registered with several

  • 0

I have a web site with many virtual hosts and each registered with several domain names (ending in .org, .de), site1.mysite.de, site2.mysite.org

Then I have different templating systems based on several programming languages (perl and php) in use on the web server.

The Google Maps Api requires a unique Google Maps api key for each vhost.

I want to have something like a web-server wide variable $goomapkey that I can call from inside my code.

In PHP code, Now I have a kludgy case-analysis solution like

 $domain = substr($_SERVER['SERVER_NAME'], -3);
 if (".de" == $domain){
   //if ("xxxxxx" eq substr($ENV{SERVER_NAME}, 0, 5)){

   //  $gookey = "ABQIAAA...";
   //} else {
     //site1.de   
     $gookey = "ABQIAAAA1Js...";
   //}
 } elseif ("dev" == substr($_SERVER['SERVER_NAME'], 0, 3)){
   //dev.mysite.org
   $gookey = "ABQIAAAA1JsSb...";
 } else {
   //www.mysite.org
   $gookey = "ABQIAAAA1JsS...";
   //TODO: Add more keys for each virtual host, for my.machinename.de, IP-address based URL, ...
 }

… inside my php-based CMS. A non-ideal solution, because it is, php-only, and I still have to set it at several html templates inside the CMS, and there are too many cases.

I want the google maps api key to be set by the apache web server who examines the request *early in the request loop before any php page template code is constructed and evaluated.

  • is an environment variable a good solution?

  • which technology should be used to set the $goomapkey variable?

I’d prefer mod_perl2 Apache request handler, but the documentation is confusing (many API changes in the past ). Which Apache module could I use?

  • Is there a built-in Apache module that does the same thing?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T00:48:15+00:00Added an answer on May 15, 2026 at 12:48 am

    Surely this is a little overkill for only a few domains? I mean, you’ve obviously had to go through the process of applying for a key for each domain, why not just use each key in each project independently?

    The most elegant solution would be to make the switch to Google Maps API v3, which no longer requires an API key.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web site in asp.net that uses a master page. In this
I have a web site using apache httpd as the server and mysql as
I have a web site which I download 2-3 MB of raw data from
I have a web site running via IIS7 on Vista. The site is running
I have a web site that is a customer to customer (C2C) service. Example,
I have a web site that I administer that uses Apache 2.0 on the
I have a web server with my web site and I am trying to
Let's say I have a web site for hosting community generated content that targets
Lately all modern programming languages have a definitive web site to support, distribute, learn
I have deployed ASP.NET web site and ASP.NET web service on the same web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.