Matomo: Generating report data fails

Published by Tobias Hofmann on

1 min read

Recently I saw that my Matomo reports were not showing the correct data. It seemed like the daily cron job wasn’t running or failing. To see what was causing this issue, I ran the archiving tool manually.

sudo /usr/bin/php /var/www/matomo/console core:archive --url=https://www.itsfullofstars.de/

Problem

The PHP script exists with an error.

Error: Got invalid response from API request: 
?module=API&method=API.get&idSite=1&period=year&date=
last7&format=php&trigger=archivephp. 
Response was 'PHP Fatal error: Allowed memory size of 
805306368 bytes exhausted (tried to allocate 131072 bytes) 
in /var/www/matomo/core/DataAccess/ArchiveWriter.php on 
line 142 PHP Fatal error: Allowed memory size of 
805306368 bytes exhausted (tried to allocate 32768 bytes) in
 /var/www/piwik/core/Http.php on line 248 '

The archive script is reaching its memory limit of 805306368 bytes. Using more is not allowed, therefore the error. 805306368 bytes == 786432 Kbyte == 768 Mbyte. Somewhere a configuration is limiting the memory usage of PHP to 768 MB.

Solution

There are many, many configuration files for PHP available in my system. Matamo is using its own configuration, located at:

/var/www/piwik/config/global.ini.php

The file contains a parameter for setting a memory limit for archiving task.

minimum_memory_limit_when_archiving = 768

768 is exactly the value reported in the error. Increasing this value to 1024 (1GB) should solve the problem.

sudo vim /var/www/piwik/config/global.ini.php
minimum_memory_limit_when_archiving = 1024

Result

Let the world know

Tobias Hofmann

Doing stuff with SAP since 1998. Open, web, UX, cloud. I am not a Basis guy, but very knowledgeable about Basis stuff, as it's the foundation of everything I do (DevOps). Performance is king, and unit tests is something I actually do. Developing HTML5 apps when HTML5 wasn't around. HCP/SCP user since 2012, NetWeaver since 2002, ABAP since 1998.

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.