symphonists / maplocationfield

[Symphony 2] Plot a location on a Google Map. Supports address geocoding.
http://symphonyextensions.com/extensions/maplocationfield/
Other
14 stars 13 forks source link

Saving API Key fails #24

Closed mprofitlich closed 6 years ago

mprofitlich commented 6 years ago

In one (just one) Symphony CMS installation I somehow cannot save any section when a maplocation field is part of it. More precisely: It does save everything but the Google Maps API Key and it won't reload the page. If I delete the maplocation field from the section, everything is back to normal, saving is no problem anymore. Updating the extension did not help neither completely uninstalling and then re-installing it.

How could I dive deeper into the problem, any hints on what to look for?

nitriques commented 6 years ago
mprofitlich commented 6 years ago

Thank you, nitriques. These are the errors logged (see below). The server runs mod_php, not php-fpm.

Error page in Browser An error occurred in /home/scheitlin/dev.scheitlin-syfrig.ch/htdocs/symphony/lib/toolkit/class.gateway.php around line 384

dev.scheitlin-syfrig.ch.ssl.error.log [Tue Mar 20 17:09:11 2018] [error] [client 178.174.1.34] PHP Fatal error: Maximum execution time of 1200 seconds exceeded in /home/scheitlin/dev.scheitlin-syfrig.ch/htdocs/symphony/lib/toolkit/class.gateway.php on line 384, referer: https://dev.scheitlin-syfrig.ch/symphony/blueprints/sections/edit/1/

Log manifest main

  1. March 2018, 16:49 > Deprecated Warning: The method Cacheable::check() is deprecated. It will be removed in Symphony 3.0.0. Please use Cacheable::read() instead. Called from fieldMapLocation::__geocodeAddress() in field.maplocation.php at line 66
  2. March 2018, 17:09 > Fatal Error: GenericExceptionHandler 1: Maximum execution time of 1200 seconds exceeded on line 384 of file /home/scheitlin/dev.scheitlin-syfrig.ch/htdocs/symphony/lib/toolkit/class.gateway.php
nitriques commented 6 years ago

Ok, so the problem might be this line which timesout. This looks like a firewall/OS issue. Can you make sure your user is able to connect to Google's server ?

nitriques commented 6 years ago

Maybe Google is rate limiting you: you might wanna check their API Console

mprofitlich commented 6 years ago

I checked the Google API Console. We haven't run out of queries. Actually, until now I did not use an API key at all. And as I cannot save a section I cannot add an API key.

While saving a section with a map location field leads to a timeout, I can without any troubles edit existing entries with a map location field and create new entries. I can also use the location search feature of map location field: When editing/creating an entry, I can enter an address and press "Update map" and it will update the map. All this tells me the server can well connect to Google.

Do have any other idea what to test?

nitriques commented 6 years ago

All this tells me the server can well connect to Google.

No because all of this is made client-side. The only time the server issues a request server-side are:

  1. When saving and entry that is only an address (no geocoded on the client-side) https://github.com/symphonists/maplocationfield/blob/master/fields/field.maplocation.php#L207
  2. When saving a field in the section editor https://github.com/symphonists/maplocationfield/blob/master/fields/field.maplocation.php#L146

Timeouts are almost never a code issue, sadly. Are you able to reproduce the problem on another computer ?

mprofitlich commented 6 years ago

The problem is solved, thanks to your hints and the help of the server administrator. He traced down the problem to a missing Curl installation:

// No CURL is available, use attempt to use normal sockets
      $handle = @fsockopen($this->_host, $this->_port, $errno, $errstr,
        $this->_timeout);
      if ($handle === ....

After he installed php5-curl the error is gone. Thank you very much for your support!

nitriques commented 6 years ago

Great !