Useful Snippets


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

Are your smart devices spying on you? Make better purchasing choices and find products that respect your privacy at

RSS Latest posts from my personal blog

Most viewed posts

Subscribe to RSS feed

Force Piwik to recreate all archived stats

Stanislav KhromovStanislav Khromov

If you have enabled “Piwik archiving” and want to to recreate all your reports, you need to perform two steps:

First, remove all database tables that start with:

Second, run the following command, with archive.php pointing to the correct path on your Piwik install:

php /var/www/piwik/misc/cron/archive.php --force-all-websites --force-all-periods=157788000 --url=

Update 2015-03-30
The old snippet above still works, but Piwik 2.12 and up now recommends using the following command instead:

php /var/www/piwik/console core:archive --force-all-websites --force-all-periods=157788000 --url=

This will recreate all reports for up to five years back in time. Beware that it can take a long time to finish.

Web Developer at Aftonbladet (Schibsted Media Group)
Any opinions on this blog are my own and do not reflect the views of my employer.
Twitter Profile
Visit my other blog

Comments 3
  • Roy
    Posted on

    Roy Roy

    Reply Author


  • Schroeffu
    Posted on

    Schroeffu Schroeffu

    Reply Author

    Your second code line is missing a whitespace:
    php /var/www/piwik/console core:archive –force-all-websites>>>>> –force-all-periods=157788000 –url=

    but thanks for that snippet