Cronjob Error - Cannot redeclare class Json

Hi,

we set up a Cronjob for archiving reports. Unfortunately it is not working. Log file shows this error messages:

INFO [2016-09-22 09:46:02] --------------------------- INFO [2016-09-22 09:46:02] INIT INFO [2016-09-22 09:46:02] Running Piwik 2.16.2 as Super User INFO [2016-09-22 09:46:02] --------------------------- INFO [2016-09-22 09:46:02] NOTES INFO [2016-09-22 09:46:02] - Reports for today will be processed at most every 150 seconds. You can change this value in Piwik UI > Settings > General Settings. INFO [2016-09-22 09:46:02] - Reports for the current week/month/year will be refreshed at most every 3600 seconds. INFO [2016-09-22 09:46:02] - Will process 14 other websites because some old data reports have been invalidated (eg. using the Log Import script) , IDs: 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16 INFO [2016-09-22 09:46:02] --------------------------- INFO [2016-09-22 09:46:02] START INFO [2016-09-22 09:46:02] Starting Piwik reports archiving... INFO [2016-09-22 09:46:02] Old report was invalidated for website id 2 INFO [2016-09-22 09:46:02] Will pre-process for website id = 2, period = day, date = last52 INFO [2016-09-22 09:46:02] - pre-processing all visits INFO [2016-09-22 09:46:02] Old report was invalidated for website id 3 INFO [2016-09-22 09:46:02] Will pre-process for website id = 3, period = day, date = last52 INFO [2016-09-22 09:46:02] - pre-processing all visits INFO [2016-09-22 09:46:03] Old report was invalidated for website id 4 INFO [2016-09-22 09:46:03] Will pre-process for website id = 4, period = day, date = last52 INFO [2016-09-22 09:46:03] - pre-processing all visits INFO [2016-09-22 09:46:03] Old report was invalidated for website id 5 INFO [2016-09-22 09:46:03] Will pre-process for website id = 5, period = day, date = last52 INFO [2016-09-22 09:46:03] - pre-processing all visits INFO [2016-09-22 09:46:03] Old report was invalidated for website id 6 INFO [2016-09-22 09:46:03] Will pre-process for website id = 6, period = day, date = last52 INFO [2016-09-22 09:46:03] - pre-processing all visits INFO [2016-09-22 09:46:04] Old report was invalidated for website id 8 INFO [2016-09-22 09:46:04] Will pre-process for website id = 8, period = day, date = last52 INFO [2016-09-22 09:46:04] - pre-processing all visits INFO [2016-09-22 09:46:04] Old report was invalidated for website id 9 INFO [2016-09-22 09:46:04] Will pre-process for website id = 9, period = day, date = last52 INFO [2016-09-22 09:46:04] - pre-processing all visits INFO [2016-09-22 09:46:05] Old report was invalidated for website id 10 INFO [2016-09-22 09:46:05] Will pre-process for website id = 10, period = day, date = last52 INFO [2016-09-22 09:46:05] - pre-processing all visits INFO [2016-09-22 09:46:05] Old report was invalidated for website id 11 INFO [2016-09-22 09:46:05] Will pre-process for website id = 11, period = day, date = last52 INFO [2016-09-22 09:46:05] - pre-processing all visits INFO [2016-09-22 09:46:05] Old report was invalidated for website id 12 INFO [2016-09-22 09:46:05] Will pre-process for website id = 12, period = day, date = last52 INFO [2016-09-22 09:46:05] - pre-processing all visits INFO [2016-09-22 09:46:06] Old report was invalidated for website id 13 INFO [2016-09-22 09:46:06] Will pre-process for website id = 13, period = day, date = last52 INFO [2016-09-22 09:46:06] - pre-processing all visits INFO [2016-09-22 09:46:06] Old report was invalidated for website id 14 INFO [2016-09-22 09:46:06] Will pre-process for website id = 14, period = day, date = last52 INFO [2016-09-22 09:46:06] - pre-processing all visits INFO [2016-09-22 09:46:06] Old report was invalidated for website id 15 INFO [2016-09-22 09:46:06] Will pre-process for website id = 15, period = day, date = last52 INFO [2016-09-22 09:46:06] - pre-processing all visits INFO [2016-09-22 09:46:07] Old report was invalidated for website id 16 INFO [2016-09-22 09:46:07] Will pre-process for website id = 16, period = day, date = last52 INFO [2016-09-22 09:46:07] - pre-processing all visits INFO [2016-09-22 09:46:07] Done archiving! INFO [2016-09-22 09:46:07] --------------------------- INFO [2016-09-22 09:46:07] SUMMARY INFO [2016-09-22 09:46:07] Total visits for today across archived websites: 0 INFO [2016-09-22 09:46:07] Archived today's reports for 0 websites INFO [2016-09-22 09:46:07] Archived week/month/year for 0 websites INFO [2016-09-22 09:46:07] Skipped 14 websites INFO [2016-09-22 09:46:07] - 0 skipped because no new visit since the last script execution INFO [2016-09-22 09:46:07] - 0 skipped because existing daily reports are less than 150 seconds old INFO [2016-09-22 09:46:07] - 0 skipped because existing week/month/year periods reports are less than 3600 seconds old INFO [2016-09-22 09:46:07] - 14 skipped because got an error while querying reporting API INFO [2016-09-22 09:46:07] Total API requests: 0 INFO [2016-09-22 09:46:07] done: 0/14 0%, 0 vtoday, 0 wtoday, 0 wperiods, 0 req, 5612 ms, 28 errors. INFO [2016-09-22 09:46:07] Time elapsed: 5.612s INFO [2016-09-22 09:46:07] --------------------------- INFO [2016-09-22 09:46:07] SCHEDULED TASKS INFO [2016-09-22 09:46:07] Starting Scheduled tasks... INFO [2016-09-22 09:46:07] done INFO [2016-09-22 09:46:07] --------------------------- INFO [2016-09-22 09:46:07] --------------------------- INFO [2016-09-22 09:46:07] SUMMARY OF ERRORS INFO [2016-09-22 09:46:07] Error: Got invalid response from API request: ?module=API&method=API.get&idSite=2&period=day&date=last52&format=php&trigger=archivephp. Response was ' Fatal error: Cannot redeclare class Piwik\Plugins\API\Renderer\Json in wwwroot/piwik_jt/plugins/API/Renderer/Json.php on line 108 ' INFO [2016-09-22 09:46:07] Error: Empty or invalid response '' for website id 2, Time elapsed: 0.388s, skipping INFO [2016-09-22 09:46:07] Error: Got invalid response from API request: ?module=API&method=API.get&idSite=3&period=day&date=last52&format=php&trigger=archivephp. Response was ' Fatal error: Cannot redeclare class Piwik\Plugins\API\Renderer\Json in wwwroot/piwik_jt/plugins/API/Renderer/Json.php on line 108 ' INFO [2016-09-22 09:46:07] Error: Empty or invalid response '' for website id 3, Time elapsed: 0.353s, skipping INFO [2016-09-22 09:46:07] Error: Got invalid response from API request: ?module=API&method=API.get&idSite=4&period=day&date=last52&format=php&trigger=archivephp. Response was ' Fatal error: Cannot redeclare class Piwik\Plugins\API\Renderer\Json in wwwroot/piwik_jt/plugins/API/Renderer/Json.php on line 108 ' INFO [2016-09-22 09:46:07] Error: Empty or invalid response '' for website id 4, Time elapsed: 0.357s, skipping INFO [2016-09-22 09:46:07] Error: Got invalid response from API request: ?module=API&method=API.get&idSite=5&period=day&date=last52&format=php&trigger=archivephp. Response was ' Fatal error: Cannot redeclare class Piwik\Plugins\API\Renderer\Json in wwwroot/piwik_jt/plugins/API/Renderer/Json.php on line 108 ' INFO [2016-09-22 09:46:07] Error: Empty or invalid response '' for website id 5, Time elapsed: 0.353s, skipping INFO [2016-09-22 09:46:07] Error: Got invalid response from API request: ?module=API&method=API.get&idSite=6&period=day&date=last52&format=php&trigger=archivephp. Response was ' Fatal error: Cannot redeclare class Piwik\Plugins\API\Renderer\Json in wwwroot/piwik_jt/plugins/API/Renderer/Json.php on line 108 ' INFO [2016-09-22 09:46:07] Error: Empty or invalid response '' for website id 6, Time elapsed: 0.359s, skipping INFO [2016-09-22 09:46:07] Error: Got invalid response from API request: ?module=API&method=API.get&idSite=8&period=day&date=last52&format=php&trigger=archivephp. Response was ' Fatal error: Cannot redeclare class Piwik\Plugins\API\Renderer\Json in wwwroot/piwik_jt/plugins/API/Renderer/Json.php on line 108 ' INFO [2016-09-22 09:46:07] Error: Empty or invalid response '' for website id 8, Time elapsed: 0.358s, skipping INFO [2016-09-22 09:46:07] Error: Got invalid response from API request: ?module=API&method=API.get&idSite=9&period=day&date=last52&format=php&trigger=archivephp. Response was ' Fatal error: Cannot redeclare class Piwik\Plugins\API\Renderer\Json in wwwroot/piwik_jt/plugins/API/Renderer/Json.php on line 108 ' INFO [2016-09-22 09:46:07] Error: Empty or invalid response '' for website id 9, Time elapsed: 0.354s, skipping INFO [2016-09-22 09:46:07] Error: Got invalid response from API request: ?module=API&method=API.get&idSite=10&period=day&date=last52&format=php&trigger=archivephp. Response was ' Fatal error: Cannot redeclare class Piwik\Plugins\API\Renderer\Json in wwwroot/piwik_jt/plugins/API/Renderer/Json.php on line 108 ' INFO [2016-09-22 09:46:07] Error: Empty or invalid response '' for website id 10, Time elapsed: 0.352s, skipping INFO [2016-09-22 09:46:07] Error: Got invalid response from API request: ?module=API&method=API.get&idSite=11&period=day&date=last52&format=php&trigger=archivephp. Response was ' Fatal error: Cannot redeclare class Piwik\Plugins\API\Renderer\Json in wwwroot/piwik_jt/plugins/API/Renderer/Json.php on line 108 ' INFO [2016-09-22 09:46:07] Error: Empty or invalid response '' for website id 11, Time elapsed: 0.352s, skipping INFO [2016-09-22 09:46:07] Error: Got invalid response from API request: ?module=API&method=API.get&idSite=12&period=day&date=last52&format=php&trigger=archivephp. Response was ' Fatal error: Cannot redeclare class Piwik\Plugins\API\Renderer\Json in wwwroot/piwik_jt/plugins/API/Renderer/Json.php on line 108 ' INFO [2016-09-22 09:46:07] Error: Empty or invalid response '' for website id 12, Time elapsed: 0.352s, skipping INFO [2016-09-22 09:46:07] Error: Got invalid response from API request: ?module=API&method=API.get&idSite=13&period=day&date=last52&format=php&trigger=archivephp. Response was ' Fatal error: Cannot redeclare class Piwik\Plugins\API\Renderer\Json in wwwroot/piwik_jt/plugins/API/Renderer/Json.php on line 108 ' INFO [2016-09-22 09:46:07] Error: Empty or invalid response '' for website id 13, Time elapsed: 0.366s, skipping INFO [2016-09-22 09:46:07] Error: Got invalid response from API request: ?module=API&method=API.get&idSite=14&period=day&date=last52&format=php&trigger=archivephp. Response was ' Fatal error: Cannot redeclare class Piwik\Plugins\API\Renderer\Json in wwwroot/piwik_jt/plugins/API/Renderer/Json.php on line 108 ' INFO [2016-09-22 09:46:07] Error: Empty or invalid response '' for website id 14, Time elapsed: 0.364s, skipping INFO [2016-09-22 09:46:07] Error: Got invalid response from API request: ?module=API&method=API.get&idSite=15&period=day&date=last52&format=php&trigger=archivephp. Response was ' Fatal error: Cannot redeclare class Piwik\Plugins\API\Renderer\Json in wwwroot/piwik_jt/plugins/API/Renderer/Json.php on line 108 ' INFO [2016-09-22 09:46:07] Error: Empty or invalid response '' for website id 15, Time elapsed: 0.364s, skipping INFO [2016-09-22 09:46:07] Error: Got invalid response from API request: ?module=API&method=API.get&idSite=16&period=day&date=last52&format=php&trigger=archivephp. Response was ' Fatal error: Cannot redeclare class Piwik\Plugins\API\Renderer\Json in wwwroot/piwik_jt/plugins/API/Renderer/Json.php on line 108 ' INFO [2016-09-22 09:46:07] Error: Empty or invalid response '' for website id 16, Time elapsed: 0.367s, skipping

Is there someone who can help me please? I have no idea what to do. We have a standard piwik installation (Version 2.16.2)

I think there is something wrong with your Piwik installation. Line 108 of that file (In my installation) is the closing bracket of the class. I would be inclined to try re-installing.

thanks for your quick reply. it is also the closing bracket in my installation.

i cant believe that i am the only person who got this problem with piwik cronjobs. :frowning:

That’s why I believe there is something wrong with your installation.

It’s definitely a problem with your Piwik. Maybe upgrade your PHP version to a newest, and try to reupload all Piwik files. it should solve this issue

Hello Where can I find the Error logs in Piwik 2.17 to see the errors generated {folder / location}
Thank You.

It’s dependent on your web server software. I use Apache and have set my PHP error logs to be the same file as my Apache error logs. Check your configuration file (For apache it’s httpd.conf) as well as your php.ini file for the location(s) for your installation.

I had the same problem. It was due to a misconfiguration of the PHP server, which had 2 caching system: xcache and opcache (which comes on PHP core from versions 5.5 and up). Disabled one of them (or both) and everything was right again.