Notice - unserialize(): Error at offset 0 of 342 bytes - Matomo 3.13.5

I receive the errors trying to archive.
WARNING [2020-05-29 10:06:18] 8956 D:\Bitnami\wampstack\apps\piwik\core\Common.php(297): Notice - unserialize(): Error at offset 0 of 342 bytes - Matomo 3.13.5 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it mi
ght have been reported already)

Certificate is valid:
INFO [2020-05-29 10:38:37] 7616 Error: Empty or invalid response ‘Got invalid response from API request: https://server.com/?module=API&method=API.get&idSite=6&period=day&date=last2&format=php&trigger=archivephp&token_auth=removed. Response was ‘curl_exec: SSL
certificate problem: self signed certificate in certificate chain. Hostname requested was: server.com’’ for website id 6, Time elapsed: 0.350s, skipping

module=API&method=API.get&idSite=33&period=day&date=last3&format=php&trigger=archivephp&token_auth=removed. Response was ‘curl_exec: SSL cert
ificate problem: self signed certificate in certificate chain. Hostname requested was: server.com’’ for website id 33, Time elapsed: 0.277s, skipping

Hi,

The question is: Valid for whom?

If your Matomo server uses a self-signed certificate (so not signed by a major CA) then it is not enough to make your Browser trust this certificate/CA. You also need to make sure the webserver itself trusts the certificate. Matomo accesses the HTTP API itself (e.g. during archiving), so you want to make sure that a curl https://your.matomo on your server also reports a valid certificate and maybe add your CA to the root CA store.

These are entrust certificates. I use them on Redhat Linux with Matomo and I’m currently moving the Matomo server to Windows 2019 using bitnami wamp server. I never noticed the issue on the redhat server.

I have ran it with php.exe “D:\Bitnami\wampstack\apps\piwik\console” core:archive --url=https://etpanalytics.jnj.com/console --accept-invalid-ssl-certificate

Now I have another error:

INFO [2020-06-02 19:54:40] 6988 Error: Got invalid response from API request: ?module=API&method=API.get&idSite=6&period=day&date=last7&format=php&trigger=archivephp. Response was ‘<?php use Piwik\FrontController; if (!defined(‘PIWIK_DOCUMENT_ROOT’)) { define(‘PIW
IK_DOCUMENT_ROOT’, dirname(FILE) == ‘/’ ? ‘’ : dirname(FILE)); } if (file_exists(PIWIK_DOCUMENT_ROOT . ‘/bootstrap.php’)) { require_once PIWIK_DOCUMENT_ROOT . ‘/bootstrap.php’; } if (!defined(‘PIWIK_INCLUDE_PATH’)) { define(‘PIWIK_INCLUDE_PATH’, PIWIK_D
OCUMENT_ROOT); } require_once PIWIK_INCLUDE_PATH . ‘/core/bootstrap.php’; if (!Piwik\Common::isPhpCliMode()) { exit; } if (!defined(‘PIWIK_ENABLE_ERROR_HANDLER’) || PIWIK_ENABLE_ERROR_HANDLER) { Piwik\ErrorHandler::registerErrorHandler(); Piwik\ExceptionHa
ndler::setUp(); } FrontController::setUpSafeMode(); $console = new Piwik\Console(); $console->run();’
INFO [2020-06-02 19:54:40] 6988 Error: Empty or invalid response ‘’ for website id 6, Time elapsed: 0.380s, skipping
INFO [2020-06-02 19:54:40] 6988 Error: Got invalid response from API request: ?module=API&method=API.get&idSite=7&period=day&date=last7&format=php&trigger=archivephp. Response was ‘<?php use Piwik\FrontController; if (!defined(‘PIWIK_DOCUMENT_ROOT’)) { define(‘PIW
IK_DOCUMENT_ROOT’, dirname(FILE) == ‘/’ ? ‘’ : dirname(FILE)); } if (file_exists(PIWIK_DOCUMENT_ROOT . ‘/bootstrap.php’)) { require_once PIWIK_DOCUMENT_ROOT . ‘/bootstrap.php’; } if (!defined(‘PIWIK_INCLUDE_PATH’)) { define(‘PIWIK_INCLUDE_PATH’, PIWIK_D
OCUMENT_ROOT); } require_once PIWIK_INCLUDE_PATH . ‘/core/bootstrap.php’; if (!Piwik\Common::isPhpCliMode()) { exit; } if (!defined(‘PIWIK_ENABLE_ERROR_HANDLER’) || PIWIK_ENABLE_ERROR_HANDLER) { Piwik\ErrorHandler::registerErrorHandler(); Piwik\ExceptionHa
ndler::setUp(); } FrontController::setUpSafeMode(); $console = new Piwik\Console(); $console->run();’
INFO [2020-06-02 19:54:40] 6988 Error: Empty or invalid response ‘’ for website id 7, Time elapsed: 0.307s, skipping

Hi,

Response was ‘<?php use Piwik\FrontController

Your webserver should never respond with PHP code as it should be executed instead. Make sure that your webserver is correctly set up to run PHP on requests.

:warning: Also this might mean that visitors opening /config/config.ini.php might be able to see its content. In that case you might want to reset the Matomo salt and your MySQL password.

Not able to connect to /config/config.ini.php

# Forbidden

You don't have permission to access this resource.
PHP Version 7.3.17
System	Windows NT AWSACRNVA1046 10.0 build 14393 (Windows Server 2016) AMD64
Build Date	Apr 14 2020 12:17:04
Compiler	MSVC15 (Visual C++ 2017)
Architecture	x64
Configure Command	cscript /nologo /e:jscript configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-pdo-oci=c:\php-snap-build\deps_aux\oracle\x64\instantclient_12_1\sdk,shared" "--with-oci8-12c=c:\php-snap-build\deps_aux\oracle\x64\instantclient_12_1\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--without-analyzer" "--with-pgo"
Server API	Apache 2.0 Handler
Virtual Directory Support	enabled
Configuration File (php.ini) Path	C:\Windows
Loaded Configuration File	D:\Bitnami\wampstack\php\php.ini
Scan this dir for additional .ini files	(none)
Additional .ini files parsed	(none)
PHP API	20180731
PHP Extension	20180731
Zend Extension	320180731
Zend Extension Build	API320180731,TS,VC15
PHP Extension Build	API20180731,TS,VC15
Debug Build	no
Thread Safety	enabled
Thread API	Windows Threads
Zend Signal Handling	disabled
Zend Memory Manager	enabled
Zend Multibyte Support	provided by mbstring
IPv6 Support	enabled
DTrace Support	disabled
Registered PHP Streams	php, file, glob, data, http, ftp, zip, compress.zlib, compress.bzip2, https, ftps, phar
Registered Stream Socket Transports	tcp, udp, ssl, tls, tlsv1.0, tlsv1.1, tlsv1.2
Registered Stream Filters	convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, zlib.*, bzip2.*