matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.87k stars 2.65k forks source link

console core:archive gets login page #12391

Closed waldner closed 5 years ago

waldner commented 6 years ago

Running the following command:

/usr/bin/php5 /var/www/piwik/console -v core:archive --url=http://my.piwik.domain/

An error is returned as follows:

INFO [2017-12-29 18:55:55] ---------------------------
INFO [2017-12-29 18:55:55] INIT
INFO [2017-12-29 18:55:55] Running Piwik 3.2.1 as Super User
INFO [2017-12-29 18:55:55] ---------------------------
INFO [2017-12-29 18:55:55] NOTES
INFO [2017-12-29 18:55:55] - Reports for today will be processed at most every 10 seconds. You can change this value in Piwik UI > Settings > General Settings.
INFO [2017-12-29 18:55:55] - Reports for the current week/month/year will be requested at most every 3600 seconds.
INFO [2017-12-29 18:55:55] - Archiving was last executed without error 2 years 174 days ago
INFO [2017-12-29 18:55:55] - Will process 1 other websites because the last time they were archived was on a different day (in the website's timezone) , IDs: 1
INFO [2017-12-29 18:55:55] - Will process 1 other websites because some old data reports have been invalidated (eg. using the Log Import script or the InvalidateReports plugin) , IDs: 1
INFO [2017-12-29 18:55:55] ---------------------------
INFO [2017-12-29 18:55:55] START
INFO [2017-12-29 18:55:55] Starting Piwik reports archiving...
INFO [2017-12-29 18:55:55] Day has finished for website id 1 since last run
INFO [2017-12-29 18:55:55] Will pre-process for website id = 1, period = day, date = last52
INFO [2017-12-29 18:55:55] - pre-processing all visits
ERROR [2017-12-29 18:55:55] Got invalid response from API request: ?module=API&method=API.get&idSite=1&period=day&date=last52&format=php&trigger=archivephp. Response was '<!DOCTYPE html> <html id="ng-app"  ng-app="piwikApp">     <head>                         <meta charset="utf-8">             <title>Sign in -                     Piwik</title>             <meta http-equiv="X-UA-Compatible" content="IE=EDGE,chrome=1"/>             <meta name="viewport" content="initial-scale=1.0"/>             <meta name="generator" content="Piwik - free/libre analytics platform"/>             <meta name="description" content="free/libre analytics platform"/>             <meta name="apple-itunes-app" content="app-id=737216887" />                 <meta name="robots" content="index,follow">                  <link rel="shortcut icon" href="plugins/CoreHome/images/favicon.png"/>              <link rel="mask-icon" href="plugins/CoreHome/images/applePinnedTab.svg" color="#d4291f">             <script type="text/javascript">     var piwik = {};     piwik.token_auth = "anonymous";     piwik.piwik_url = "http://my.piwik.domain/";     piwik.cacheBuster = "d2e7fd4a91124ea576d31fc01728b4e7";      piwik.numbers = {         patternNumber: "#,##0.###",         patternPercent: "#,##0%",         patternCurrency: "¤#,##0.00",         symbolPlus: "+",         symbolMinus: "-",         symbolPercent: "%",         symbolGroup: ",",         symbolDecimal: "."     };      piwik.userLogin = "anonymous";                         piwik.currentDateString = "";          piwik.hasSuperUserAccess = 0;     piwik.config = {};     piwik.config = {"action_url_category_delimiter":"\/","action_title_category_delimiter":"\/","autocomplete_min_sites":5,"datatable_export_range_as_day":"rss","datatable_row_limits":["5","10","25","50","100","250","500","-1"],"are_ads_enabled":true};     piwik.hasServerDetectedHttps = false; piwik.languageName = 'English'; </script>                 <link rel="stylesheet" type="text/css" href="index.php?module=Proxy&amp;action=getCss&amp;cb=b933eedc12d0de1fbbd836552b67f7d3" />      <script type="text/javascript"> var translations = {"CorePluginsAdmin_NoZipFileSelected":"Please select a ZIP file.","CorePluginsAdmin_NoPluginSettings":"No plugin settings that can be configured","CoreAdminHome_PluginSettingsIntro":"Here you can change the settings for the following 3rd party plugins:","CoreAdminHome_PluginSettingsSaveSuccess":"Plugin settings updated.","General_Save":"Save","CoreAdminHome_ProtocolNotDetectedCorrectly":"You are currently viewing Piwik over a secure SSL connection (using https), but Piwik could only detect a non secure connection on the server. ","CoreAdminHome_ProtocolNotDetectedCorrectlySolution":"To make sure Piwik securely requests and serves your content over HTTPS, you may edit your %1$s file and either configure your proxy settings, or you may add the line %2$s below the %3$s section. %4$sLearn more%5$s","CoreAdminHome_SettingsSaveSuccess":"Settings updated.","UserCountryMap_None":"None","General_InvalidDateRange":"Invalid Date Range, Please Try Again","General_Loading":"Loading...","General_Show":"show","General_Hide":"hide","General_Website":"Website","Intl_Year_Short":"yr.","General_MultiSitesSummary":"All Websites","General_SearchNoResults":"No results","CoreHome_ChooseX":"Choose %1$s","CoreHome_ClickToSeeFullInformation":"Click to see the full information","CoreHome_YouAreUsingTheLatestVersion":"You are using the latest version of Piwik!","CoreHome_IncludeRowsWithLowPopulation":"Rows with low population are hidden %s Show all rows","CoreHome_ExcludeRowsWithLowPopulation":"All rows are shown %s Exclude low population","CoreHome_DataTableIncludeAggregateRows":"Aggregate rows are hidden %s Show them","CoreHome_DataTableExcludeAggregateRows":"Aggregate rows are shown %s Hide them","CoreHome_Default":"default","CoreHome_PageOf":"%1$s of %2$s","CoreHome_FlattenDataTable":"The report is hierarchical %s Make it flat","CoreHome_UnFlattenDataTable":"The report is flat %s Make it hierarchical","CoreHome_ExternalHelp":"Help (opens in new tab)","CoreHome_ClickToEditX":"Click to edit %s","CoreHome_Menu":"Menu","SitesManager_NotFound":"No websites found for","Annotations_ViewAndAddAnnotations":"View and add annotations for %s...","General_RowEvolutionRowActionTooltipTitle":"Open Row Evolution","General_RowEvolutionRowActionTooltip":"See how the metrics for this row changed over time","Annotations_IconDesc":"View notes for this date range.","Annotations_IconDescHideNotes":"Hide notes for this date range.","Annotations_HideAnnotationsFor":"Hide annotations for %s...","General_LoadingPopover":"Loading %s...","General_LoadingPopoverFor":"Loading %s for","Intl_Month_Short_StandAlone_1":"Jan","Intl_Month_Short_StandAlone_2":"Feb","Intl_Month_Short_StandAlone_3":"Mar","Intl_Month_Short_StandAlone_4":"Apr","Intl_Month_Short_StandAlone_5":"May","Intl_Month_Short_StandAlone_6":"Jun","Intl_Month_Short_StandAlone_7":"Jul","Intl_Month_Short_StandAlone_8":"Aug","Intl_Month_Short_StandAlone_9":"Sep","Intl_Month_Short_StandAlone_10":"Oct","Intl_Month_Short_StandAlone_11":"Nov","Intl_Month_Short_StandAlone_12":"Dec","Intl_Month_Long_StandAlone_1":"January","Intl_Month_Long_StandAlone_2":"February","Intl_Month_Long_StandAlone_3":"March","Intl_Month_Long_StandAlone_4":"April","Intl_Month_Long_StandAlone_5":"May","Intl_Month_Long_StandAlone_6":"June","Intl_Month_Long_StandAlone_7":"July","Intl_Month_Long_StandAlone_8":"August","Intl_Month_Long_StandAlone_9":"September","Intl_Month_Long_StandAlone_10":"October","Intl_Month_Long_StandAlone_11":"November","Intl_Month_Long_StandAlone_12":"December","Intl_Day_Short_StandAlone_1":"Mon","Intl_Day_Short_StandAlone_2":"Tue","Intl_Day_Short_StandAlone_3":"Wed","Intl_Day_Short_StandAlone_4":"Thu","Intl_Day_Short_StandAlone_5":"Fri","Intl_Day_Short_StandAlone_6":"Sat","Intl_Day_Short_StandAlone_7":"Sun","Intl_Day_Long_StandAlone_1":"Monday","Intl_Day_Long_StandAlone_2":"Tuesday","Intl_Day_Long_StandAlone_3":"We
ERROR [2017-12-29 18:55:55] Empty or invalid response '' for website id 1, Time elapsed: 0.328s, skipping
INFO [2017-12-29 18:55:55] Done archiving!
INFO [2017-12-29 18:55:55] ---------------------------
INFO [2017-12-29 18:55:55] SUMMARY
INFO [2017-12-29 18:55:55] Total visits for today across archived websites: 0
INFO [2017-12-29 18:55:55] Archived today's reports for 0 websites
INFO [2017-12-29 18:55:55] Archived week/month/year for 0 websites
INFO [2017-12-29 18:55:55] Skipped 1 websites
INFO [2017-12-29 18:55:55] - 0 skipped because no new visit since the last script execution
INFO [2017-12-29 18:55:55] - 0 skipped because existing daily reports are less than 10 seconds old
INFO [2017-12-29 18:55:55] - 0 skipped because existing week/month/year periods reports are less than 3600 seconds old
INFO [2017-12-29 18:55:55] - 1 skipped because got an error while querying reporting API
INFO [2017-12-29 18:55:55] Total API requests: 0
INFO [2017-12-29 18:55:55] done: 0/1 0%, 0 vtoday, 0 wtoday, 0 wperiods, 0 req, 333 ms, 2 errors.
INFO [2017-12-29 18:55:55] Time elapsed: 0.333s
INFO [2017-12-29 18:55:55] ---------------------------
INFO [2017-12-29 18:55:55] SCHEDULED TASKS
INFO [2017-12-29 18:55:55] Starting Scheduled tasks... 
INFO [2017-12-29 18:55:55] done
INFO [2017-12-29 18:55:55] ---------------------------
INFO [2017-12-29 18:55:55] ---------------------------
INFO [2017-12-29 18:55:55] SUMMARY OF ERRORS
INFO [2017-12-29 18:55:55] Error: Got invalid response from API request: ?module=API&method=API.get&idSite=1&period=day&date=last52&format=php&trigger=archivephp. Response was '<!DOCTYPE html> <html id="ng-app"  ng-app="piwikApp">     <head>                         <meta charset="utf-8">             <title>Sign in -                     Piwik</title>             <meta http-equiv="X-UA-Compatible" content="IE=EDGE,chrome=1"/>             <meta name="viewport" content="initial-scale=1.0"/>             <meta name="generator" content="Piwik - free/libre analytics platform"/>             <meta name="description" content="free/libre analytics platform"/>             <meta name="apple-itunes-app" content="app-id=737216887" />                 <meta name="robots" content="index,follow">                  <link rel="shortcut icon" href="plugins/CoreHome/images/favicon.png"/>              <link rel="mask-icon" href="plugins/CoreHome/images/applePinnedTab.svg" color="#d4291f">             <script type="text/javascript">     var piwik = {};     piwik.token_auth = "anonymous";     piwik.piwik_url = "http://my.piwik.domain/";     piwik.cacheBuster = "d2e7fd4a91124ea576d31fc01728b4e7";      piwik.numbers = {         patternNumber: "#,##0.###",         patternPercent: "#,##0%",         patternCurrency: "¤#,##0.00",         symbolPlus: "+",         symbolMinus: "-",         symbolPercent: "%",         symbolGroup: ",",         symbolDecimal: "."     };      piwik.userLogin = "anonymous";                         piwik.currentDateString = "";          piwik.hasSuperUserAccess = 0;     piwik.config = {};     piwik.config = {"action_url_category_delimiter":"\/","action_title_category_delimiter":"\/","autocomplete_min_sites":5,"datatable_export_range_as_day":"rss","datatable_row_limits":["5","10","25","50","100","250","500","-1"],"are_ads_enabled":true};     piwik.hasServerDetectedHttps = false; piwik.languageName = 'English'; </script>                 <link rel="stylesheet" type="text/css" href="index.php?module=Proxy&amp;action=getCss&amp;cb=b933eedc12d0de1fbbd836552b67f7d3" />      <script type="text/javascript"> var translations = {"CorePluginsAdmin_NoZipFileSelected":"Please select a ZIP file.","CorePluginsAdmin_NoPluginSettings":"No plugin settings that can be configured","CoreAdminHome_PluginSettingsIntro":"Here you can change the settings for the following 3rd party plugins:","CoreAdminHome_PluginSettingsSaveSuccess":"Plugin settings updated.","General_Save":"Save","CoreAdminHome_ProtocolNotDetectedCorrectly":"You are currently viewing Piwik over a secure SSL connection (using https), but Piwik could only detect a non secure connection on the server. ","CoreAdminHome_ProtocolNotDetectedCorrectlySolution":"To make sure Piwik securely requests and serves your content over HTTPS, you may edit your %1$s file and either configure your proxy settings, or you may add the line %2$s below the %3$s section. %4$sLearn more%5$s","CoreAdminHome_SettingsSaveSuccess":"Settings updated.","UserCountryMap_None":"None","General_InvalidDateRange":"Invalid Date Range, Please Try Again","General_Loading":"Loading...","General_Show":"show","General_Hide":"hide","General_Website":"Website","Intl_Year_Short":"yr.","General_MultiSitesSummary":"All Websites","General_SearchNoResults":"No results","CoreHome_ChooseX":"Choose %1$s","CoreHome_ClickToSeeFullInformation":"Click to see the full information","CoreHome_YouAreUsingTheLatestVersion":"You are using the latest version of Piwik!","CoreHome_IncludeRowsWithLowPopulation":"Rows with low population are hidden %s Show all rows","CoreHome_ExcludeRowsWithLowPopulation":"All rows are shown %s Exclude low population","CoreHome_DataTableIncludeAggregateRows":"Aggregate rows are hidden %s Show them","CoreHome_DataTableExcludeAggregateRows":"Aggregate rows are shown %s Hide them","CoreHome_Default":"default","CoreHome_PageOf":"%1$s of %2$s","CoreHome_FlattenDataTable":"The report is hierarchical %s Make it flat","CoreHome_UnFlattenDataTable":"The report is flat %s Make it hierarchical","CoreHome_ExternalHelp":"Help (opens in new tab)","CoreHome_ClickToEditX":"Click to edit %s","CoreHome_Menu":"Menu","SitesManager_NotFound":"No websites found for","Annotations_ViewAndAddAnnotations":"View and add annotations for %s...","General_RowEvolutionRowActionTooltipTitle":"Open Row Evolution","General_RowEvolutionRowActionTooltip":"See how the metrics for this row changed over time","Annotations_IconDesc":"View notes for this date range.","Annotations_IconDescHideNotes":"Hide notes for this date range.","Annotations_HideAnnotationsFor":"Hide annotations for %s...","General_LoadingPopover":"Loading %s...","General_LoadingPopoverFor":"Loading %s for","Intl_Month_Short_StandAlone_1":"Jan","Intl_Month_Short_StandAlone_2":"Feb","Intl_Month_Short_StandAlone_3":"Mar","Intl_Month_Short_StandAlone_4":"Apr","Intl_Month_Short_StandAlone_5":"May","Intl_Month_Short_StandAlone_6":"Jun","Intl_Month_Short_StandAlone_7":"Jul","Intl_Month_Short_StandAlone_8":"Aug","Intl_Month_Short_StandAlone_9":"Sep","Intl_Month_Short_StandAlone_10":"Oct","Intl_Month_Short_StandAlone_11":"Nov","Intl_Month_Short_StandAlone_12":"Dec","Intl_Month_Long_StandAlone_1":"January","Intl_Month_Long_StandAlone_2":"February","Intl_Month_Long_StandAlone_3":"March","Intl_Month_Long_StandAlone_4":"April","Intl_Month_Long_StandAlone_5":"May","Intl_Month_Long_StandAlone_6":"June","Intl_Month_Long_StandAlone_7":"July","Intl_Month_Long_StandAlone_8":"August","Intl_Month_Long_StandAlone_9":"September","Intl_Month_Long_StandAlone_10":"October","Intl_Month_Long_StandAlone_11":"November","Intl_Month_Long_StandAlone_12":"December","Intl_Day_Short_StandAlone_1":"Mon","Intl_Day_Short_StandAlone_2":"Tue","Intl_Day_Short_StandAlone_3":"Wed","Intl_Day_Short_StandAlone_4":"Thu","Intl_Day_Short_StandAlone_5":"Fri","Intl_Day_Short_StandAlone_6":"Sat","Intl_Day_Short_StandAlone_7":"Sun","Intl_Day_Long_StandAlone_1":"Monday","Intl_Day_Long_StandAlone_2":"Tuesday","Intl_Day_Long_StandAlone_3":"We
INFO [2017-12-29 18:55:55] Error: Empty or invalid response '' for website id 1, Time elapsed: 0.328s, skipping
ERROR [2017-12-29 18:55:55] 2 total errors during this script execution, please investigate and try and fix these errors.

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

Exception trace:
 () at /var/www/piwik/core/CronArchive.php:497
 Piwik\CronArchive->logFatalError() at /var/www/piwik/core/CronArchive.php:490
 Piwik\CronArchive->end() at /var/www/piwik/core/CronArchive.php:292
 Piwik\CronArchive->Piwik\{closure}() at /var/www/piwik/core/Access.php:469
 Piwik\Access::doAsSuperUser() at /var/www/piwik/core/CronArchive.php:293
 Piwik\CronArchive->main() at /var/www/piwik/plugins/CoreConsole/Commands/CoreArchiver.php:27
 Piwik\Plugins\CoreConsole\Commands\CoreArchiver->execute() at /var/www/piwik/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
 Symfony\Component\Console\Command\Command->run() at /var/www/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php:874
 Symfony\Component\Console\Application->doRunCommand() at /var/www/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php:195
 Symfony\Component\Console\Application->doRun() at n/a:n/a
 call_user_func() at /var/www/piwik/core/Console.php:80
 Piwik\Console->Piwik\{closure}() at /var/www/piwik/core/Access.php:469
 Piwik\Access::doAsSuperUser() at /var/www/piwik/core/Console.php:81
 Piwik\Console->doRun() at /var/www/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at /var/www/piwik/console:27

core:archive [--url="..."] [--force-all-websites] [--force-all-periods[="..."]] [--force-timeout-for-periods[="..."]] [--skip-idsites[="..."]] [--skip-all-segments] [--force-idsites[="..."]] [--force-periods[="..."]] [--force-date-last-n="..."] [--force-date-range[="..."]] [--force-idsegments="..."] [--concurrent-requests-per-website[="..."]] [--disable-scheduled-tasks] [--accept-invalid-ssl-certificate] [--php-cli-options[="..."]]

And indeed, the result of fetching the indicated url (?module=API&method=API.get&idSite=1&period=day&date=last52&format=php&trigger=archivephp) is the piwik login page.

I'm not sure how to go about this, similar reports usually are about empty responses or memory problems, but I don't see either of them here. Also, no errors in the web server logs.

mattab commented 5 years ago

Maybe your webserver needs to have the index.php, so could you add index.php in your Matomo URL eg. change from:

/usr/bin/php5 /var/www/piwik/console -v core:archive --url=http://my.piwik.domain/

to

/usr/bin/php5 /var/www/piwik/console -v core:archive --url=http://my.piwik.domain/index.php

Does it work then?

waldner commented 5 years ago

It started working again after I migrated the whole thing to docker + php7. Don't know exactly what made it work though.

tsteur commented 5 years ago

Thanks for letting us know