Forum

Thread tagged as: Problem, Error

Using Maps fails on windows server

I have a site with three maps on the contact page. Perch is updated to Perch: 2.8.31.

Page works fine on a linux staging server. However when moved to the clients live server (windows) the maps fail.

The maps view initially and then disappear with an error "this page didn't load google maps". Console says...

Google Maps API warning: InvalidKey https://developers.google.com/maps/documentation/javascript/error-messages#invalid-key

And ideas on a fix?

Perch: 2.8.31, PHP: 5.6.24, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (2.8.31), assets (2.8.31), categories (2.8.31)
App runtimes: <?php $apps_list = array( 'content', 'categories', );
PERCH_LOGINPATH: /cms
PERCH_PATH: /homepages/45/d180427405/htdocs/mor073/cms
PERCH_CORE: /homepages/45/d180427405/htdocs/mor073/cms/core
PERCH_RESFILEPATH: /homepages/45/d180427405/htdocs/mor073/cms/resources
Image manipulation: GD
PHP limits: Max upload 64M, Max POST 64M, Memory: 256M, Total max file upload: 64M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
HTTP_HOST: moreukltd.co.uk
DOCUMENT_ROOT: /kunden/homepages/45/d180427405/htdocs/mor073
REQUEST_URI: /cms/core/settings/diagnostics/
SCRIPT_NAME: /cms/core/settings/diagnostics/index.php
David Owen

David Owen 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you added your API key to the config file?

Ah! Do I need to do this? I don't recall ever doing this on any other Perch site. As in, the same code works on the linux staging server.

...no wait the staging server does not. But other Perch maps on other site do with no API key for want I can see.

I fixed the issue on the staging linux server by re-saving the map locations in the editor control panel.

Hopefully thought re-saving same would fix the windows server too. The unlike the linux server the widows server maps there do not display at all in the editor control panel with the first error...

https://maps.google.com/maps/api/staticmap?center=53.79277077941179,-1.5868643606017918&size=400x300&zoom=15&maptype=roadmap&markers=color:red|color:red|53.79250774504415,-1.586751937866211
[Error] Failed to load resource: the server responded with a status of 403 (Forbidden) (staticmap, line 0)

and then

[Error] Google Maps API error: MissingKeyMapError https://developers.google.com/maps/documentation/javascript/error-messages#missing-key-map-error
    Za (js:31:426)
    (anonymous function) (common.js:51:476)
    (anonymous function) (common.js:191:173)
    c (common.js:45:407)
    global code (AuthenticationService.Authenticate:1)

Now is that an issue with the server not allowing the map to load first and then the API key fails?

Why would the linux server working and windows server not.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yup, got it. With a whole load of Google jiggery pokery. Works now.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You can thank Google for that one.