I can’t run the misc/cron/archive.php?token_auth= script after upgrading Piwik from 2.2.0 -> 2.11.2. Here are the errors I get:
INFO Piwik\Access[2015-03-12 19:45:57] [edab5] --------------------------- INFO Piwik\Access[2015-03-12 19:45:57] [edab5] INIT INFO Piwik\Access[2015-03-12 19:45:57] [edab5] Piwik is installed at: https://www.domai.com/piwik/index.php INFO Piwik\Access[2015-03-12 19:45:57] [edab5] Running Piwik 2.11.2 as Super User ERROR Piwik\Access[2015-03-12 19:45:57] [edab5] The Piwik URL https://www.domai.com/piwik/index.php does not seem to be pointing to a Piwik server. Response was 'Got invalid response from API request: https://www.domai.com/piwik/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp. Response was 'curl_exec: SSL peer certificate or SSH remote key was not OK. Hostname requested was: www.domai.com''.
Fatal error: Uncaught exception 'Exception' with message 'The Piwik URL https://www.domai.com/piwik/index.php does not seem to be pointing to a Piwik server. Response was 'Got invalid response from API request: https://www.domai.com/piwik/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp. Response was 'curl_exec: SSL peer certificate or SSH remote key was not OK. Hostname requested was: www.domai.com''.' in /home/piwik/core/CronArchive.php:406 Stack trace: #0 /home/piwik/core/CronArchive.php(1204): Piwik\CronArchive->logFatalError('The Piwik URL h...') #1 /home/piwik/core/CronArchive.php(250): Piwik\CronArchive->checkPiwikUrlIsValid() #2 /home/piwik/core/CronArchive.php(237): Piwik\CronArchive->init() #3 /home/piwik/core/Access.php(454): Piwik\{closure}() #4 /home/piwik/core/CronArchive.php(241): Piwik\ in /home/piwik/core/CronArchive.php on line 406
Fatal error: Uncaught exception 'Zend_Session_Exception' with message 'Session must be started before any output has been sent to the browser; output started in /home/piwik/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php/93' in /home/piwik/libs/Zend/Session.php:443 Stack trace: #0 /home/piwik/libs/Zend/Session/Namespace.php(143): Zend_Session::start(true) #1 /home/piwik/core/Session/SessionNamespace.php(34): Zend_Session_Namespace->__construct('CorePluginsAdmi...', false) #2 /home/piwik/core/Nonce.php(39): Piwik\Session\SessionNamespace->__construct('CorePluginsAdmi...') #3 /home/piwik/plugins/CorePluginsAdmin/Controller.php(385): Piwik\Nonce::getNonce('CorePluginsAdmi...') #4 [internal function]: Piwik\Plugins\CorePluginsAdmin\Controller->safemode(Array) #5 /home/piwik/core/FrontController.php(604): call_user_func_array(Array, Array) #6 /home/ in /home/piwik/libs/Zend/Session.php on line 443
Here is the error message when trying to execute the bash file which executes the console:
sh: /bin/uname: Permission denied
sh: /bin/uname: Permission denied
ERROR CoreConsole[2015-03-19 14:22:23] The Piwik URL http://domain.name/piwik/index.php does not seem to be pointing to a Piwik server. Response was 'sh: /bin/uname: Permission denied a:82:{s:9:"nb_visits";s:6:"Visits";s:16:"nb_uniq_visitors";s:15:" .... Some more text that looks like Piwik stats;}'.
ERROR CoreConsole[2015-03-19 14:22:23] The Piwik URL http://domain.name/piwik/index.php does not seem to be pointing to a Piwik server. Response was 'sh: /bin/uname: Permission denied a:82:{s:9:"nb_visits";s:6:"Visits";s:16:"nb_uniq_visitors";s:15:" .... Some more text that looks like Piwik stats;}'.
[Exception]
The Piwik URL http://domain.name/piwik/index.php does not seem to be pointing to a Piwik server. Response was 'sh: /bin/uname: Permission denied a:82:{s:9:"nb_visits";s:6:"Visits";s:16:"nb_uniq_visitors";s:15:" .... Some more text that looks like Piwik stats;}'.
core:archive [--url="..."] [--force-all-websites] [--force-all-periods[="..."]] [--force-timeout-for-periods[="..."]] [--skip-idsites[="..."]] [--force-idsites[="..."]] [--force-periods[="..."]] [--force-date-last-n="..."] [--force-date-range[="..."]] [--concurrent-requests-per-website[="..."]] [--disable-scheduled-tasks] [--accept-invalid-ssl-certificate] [--xhprof]
private static function isSystemNotSupported()
{
#$uname = @shell_exec('uname -a');
$uname = @shell_exec('uname -a 2> /dev/null');
if (empty($uname)) {
$uname = php_uname();
}
if (strpos($uname, 'synology') !== false) {
return true;
}
return false;
}
Tried executing again, with and without --accept-invalid-ssl-certificate as Matthieu Napoli suggested - the result is the same in both cases:
ERROR CoreConsole[2015-03-20 11:05:05] Got invalid response from API request: http://domain.name/piwik/index.php?module=API&method=API.get&idSite=1&period=week&date=last260&format=php&token_auth=removed&trigger=archivephp. Response was ' Fatal error: Out of memory (allocated 28311552) (tried to allocate 4104 bytes) in /home/piwik/core/DataTable.php on line 1156 '
ERROR CoreConsole[2015-03-20 11:05:08] Got invalid response from API request: http://domain.name/piwik/index.php?module=API&method=API.get&idSite=1&period=month&date=last52&format=php&token_auth=removed&trigger=archivephp. Response was 'aOut of memory (Needed 8164 bytes) a:2:{s:6:"result";s:5:"error";s:7:"message";s:67:"SQLSTATE[HY000]: General error: 2008 MySQL client ran out of memory";}'
ERROR CoreConsole[2015-03-20 11:05:10] Got invalid response from API request: http://domain.name/piwik/index.php?module=API&method=API.get&idSite=1&period=year&date=last7&format=php&token_auth=removed&trigger=archivephp. Response was 'aOut of memory (Needed 24492 bytes) a:2:{s:6:"result";s:5:"error";s:7:"message";s:67:"SQLSTATE[HY000]: General error: 2008 MySQL client ran out of memory";}'
ERROR CoreConsole[2015-03-20 11:05:11] 3 total errors during this script execution, please investigate and try and fix these errors.
ERROR CoreConsole[2015-03-20 11:05:11] 3 total errors during this script execution, please investigate and try and fix these errors.
[Exception]
3 total errors during this script execution, please investigate and try and fix these errors.
aOut of memory (Needed 24492 bytes) a:2:{s:6:“result”;s:5:“error”;s:7:“message”;s:67:“SQLSTATE[HY000]: General error: 2008 MySQL client ran out of memory”;
please increase the memory for your mysql server and php configuration
You will need to make your site have less traffic then (just kidding)
The (soon-to-be-released) Piwik 2.12.0 comes with a few memory improvements maybe it will help but there’s no guarantee at all. You most likely need to allow more RAM usage.
Unfortunately I’m not allowed any more RAM (shared hosting), but the site in question is getting only ~7000 visitors a month. I have another with a lot more traffic, running an older version of Piwik that works OK. It doesn’t make sense to me that an older version of Piwik on a site with 10 times the traffic would require less resources (same shared hosting). I will wait for the new version then.
Also of note is that the I have selected the option “Allow Piwik archiving to trigger when reports are viewed from the browser” and archiving through that option works fine without any errors at all. So why would this work fine and the console archiving not work?
Also of note is that the I have selected the option “Allow Piwik archiving to trigger when reports are viewed from the browser” and archiving through that option works fine without any errors at all. So why would this work fine and the console archiving not work?
Because there is a different PHP configuration depending on your web server or when you call it via cron / CLI.
I think your PHP CLI configuration does not have enough memory
250MB is quite low. That explains the previous error if it was even lower. I think for more traffic you might need a little more (but it always depends what “more traffic” means).