@pixel8383 opened this Issue on November 15th 2020

Every day I get this error from my Matomo installation:

ERROR [2020-11-15 22:59:05] 3  Error unserializing the following response from ?module=API&method=API.get&idSite=1&period=week&date=last2&format=php&trigger=archivephp: Got invalid response from API request: https://mysite.it/piwik/?module=API&method=API.get&idSite=1&period=week&date=last2&format=php&trigger=archivephp&token_auth=removed. Response was 'curl_exec: Could not resolve host: mysite.it. Hostname requested was: mysite.it'
ERROR [2020-11-15 22:59:05] 3  1 total errors during this script execution, please investigate and try and fix these errors.
ERROR [2020-11-15 22:59:05] 3  Uncaught exception: /home/webuser/public_html/mysite/piwik/core/CronArchive.php(606): 1 total errors during this script execution, please investigate and try and fix these errors.
1 total errors during this script execution, please investigate and try and fix these errors.
<a href='/0'>#0</a> /home/webuser/public_html/mysite/piwik/core/CronArchive.php(599): Piwik\CronArchive->logFatalError('1 total errors ...')
<a href='/1'>#1</a> /home/webuser/public_html/mysite/piwik/core/CronArchive.php(331): Piwik\CronArchive->end()
<a href='/2'>#2</a> /home/webuser/public_html/mysite/piwik/core/Access.php(635): Piwik\CronArchive->Piwik\{closure}()
<a href='/3'>#3</a> /home/webuser/public_html/mysite/piwik/core/CronArchive.php(335): Piwik\Access::doAsSuperUser(Object(Closure))
<a href='/4'>#4</a> /home/webuser/public_html/mysite/piwik/plugins/CoreConsole/Commands/CoreArchiver.php(27): Piwik\CronArchive->main()
<a href='/5'>#5</a> /home/webuser/public_html/mysite/piwik/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): Piwik\Plugins\CoreConsole\Commands\CoreArchiver->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
<a href='/6'>#6</a> /home/webuser/public_html/mysite/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
<a href='/7'>#7</a> /home/webuser/public_html/mysite/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Piwik\Plugins\CoreConsole\Commands\CoreArchiver), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
<a href='/8'>#8</a> [internal function]: Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
<a href='/9'>#9</a> /home/webuser/public_html/mysite/piwik/core/Console.php(140): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
<a href='/10'>#10</a> /home/webuser/public_html/mysite/piwik/core/Access.php(644): Piwik\Console->Piwik\{closure}()
<a href='/11'>#11</a> /home/webuser/public_html/mysite/piwik/core/Console.php(141): Piwik\Access::doAsSuperUser(Object(Closure))
<a href='/12'>#12</a> /home/webuser/public_html/mysite/piwik/core/Console.php(93): Piwik\Console->doRunImpl(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
<a href='/13'>#13</a> /home/webuser/public_html/mysite/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
<a href='/14'>#14</a> /home/webuser/public_html/mysite/piwik/console(32): Symfony\Component\Console\Application->run()
<a href='/15'>#15</a> {main}

  [Exception]                                                                                    
  1 total errors during this script execution, please investigate and try and fix these errors.  

(I changed my website name with mysite.it)

I already tried to check the host resolution via SSH with host mysite.it and the machine can resolve the name correctly.

What can I do in order to fix it?

@tsteur commented on November 15th 2020 Member

Hi @pixel8383 thanks for creating this issue. It sounds like some kind of server configuration issue to me which we might not be able to help with here and you might be better off asking this question in our forum: https://forum.matomo.org/

Can you confirm the actual domain it is trying to fetch the data from is correct? (the original domain you replaced with mysite.it)

In case you are familiar with MySQL and can access the database, any chance you could also verify the URL/domain shown when executing below query is correct and it if eg https is used, that the webserver supports this?

select * from matomo_option where option_name like '%piwikurl%'
@pixel8383 commented on November 16th 2020

Hello @tsteur thanks for your support. I did the query as you suggested and later I tested via SSH the url I got with "curl ". Everything was fine, what I got is a login webpage to piwik/matomo. So, the url to fetch is correct.

@tsteur commented on November 16th 2020 Member

@pixel8383 I suggest you ask for more help in the forum (or on stackoverflow).

If you search for curl_exec: Could not resolve host . Hostname requested was you might also get more information such as https://stackoverflow.com/questions/1341644/curl-and-https-cannot-resolve-host

I'm wondering if there's some issue with IPv4 and IPv6 and that PHP resolves to different IP (pretty sure we've seen this before and there's also https://github.com/matomo-org/matomo/issues/11508 )

in case you are familiar with editing PHP files: For one user it helped to add a new line around https://github.com/matomo-org/matomo/blob/3.14.1/core/Http.php#L591 with such content: curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );

any chance can you disable/enable IPv6 on your server and see if it changes anything?

@pixel8383 commented on November 16th 2020

Unfortunately I cannot setup the network (I am on a Shared Hosting, I installed Matomo using Softaculous (and I loved to share Matamo as perfect alternative to Google Analytics). I couldn't locate where to insert that content (I mean, I can edit the file but can't locate the line). What I don't get is that the url is fetched fine if I directly try to curl it on the machine, seems like something PHP related maybe.

@pixel8383 commented on November 16th 2020

I just tried to setup a test php file as shown here and the https website is fetched fine.

@tsteur commented on November 16th 2020 Member

@pixel8383 any chance maybe a proxy is configured in the config/config.ini.php? Like

[proxy]
host = ...
port = ...

Matomo sets a few more options see the lines in https://github.com/matomo-org/matomo/blob/3.14.1/core/Http.php#L547-L632

In case you are familiar with PHP you could some lines one after another and see if it eventually starts working and maybe this way find out why it is failing

Powered by GitHub Issue Mirror