Matomo: Generating report data fails
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/
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.
There are many, many configuration files for PHP available in my system. Matamo is using its own configuration, located at:
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