Matomo Migration error "Fatal error: Allowed memory size of 134217728 bytes exhausted"

I’m moving one Matomo instance to another. Once I ironed out the kinks, everything worked well for the smaller sites with only a few thousand visits. But now I’m trying to move a site that has ~25,000 visits, and getting the following error:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 163840 bytes) in /home/public/stats/matomo/plugins/Migration/Migrations/LogMigration.php on line 89
ERROR [2021-06-09 22:10:23] 95343  Fatal error encountered: /home/public/stats/matomo/plugins/Migration/Migrations/LogMigration.php(89): Allowed memory size of 134217728 bytes exhausted (tried to allocate 163840 bytes)

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65536 bytes) in /home/public/stats/matomo/core/Updater.php on line 591

I looked on the forums for my webhost, and they say “PHP 5.4+ does not use memory_limit” (I’m on PHP 7.4) so why is my task running out of memory?

Just for kicks, I tried running top on my server, and it shows 5109M of inactive memory. That should be enough, methinks!

I also tried lowering the limit of visits that are being migrated at once. Eg change in plugins/Migration/Db/BatchQuery.php the limit from 10000 to 2000, but that didn’t help. :frowning: What else can I try?

I got a faster answer from my webhost, who recommended adding this memory_limit = 256M to my php.ini file. And it worked!

1 Like