Cron Archiving Error - PHP Warning: Unexpected character in input: '\'


I’ve set up a cron job for archiving. PHP version is 5.3.24. The command works when I run it outside of cron. But the cron job gives me this message:

Error in the last Piwik archive.php run: 
The Piwik URL https://[domain]/index.php does not seem to be pointing to a Piwik server. Response was ''.

 Here is the full errors output:

Piwik is installed at: https://[domain]/index.php
Running Piwik 2.2.0 as Super User
ERROR: Got invalid response from API request: https://[domain]/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp. Response was 'PHP Warning:  Unexpected character in input:  '\' (ASCII=92) state=1 in /path/to/piwik/console on line 20
PHP Parse error:  syntax error, unexpected T_STRING in /path/to/piwik/console on line 20

Any idea what could cause this?

PS: I saw somebody else who seems to have the same problem posted about it in the forums, too. But this was in an other, as it seems, unrelated threads. I couldn’t find anything else about it, so I’m opening a new one.

(Matthieu Aubry) #2

PHP Warning: Unexpected character in input: ‘’ (ASCII=92) state=1 in /path/to/piwik/console on line 20

This is likely that your PHP CLI does not have at least PHP 5.3. Please check or ask your webhost


Hmm, it works with PHP 5.4 and above in cron. Without cron, PHP 5.3 works too. I 'm not sure what the difference is. Strange, but it works.

Thanks for the hint.