Archive.php on Piwik 2.4.0-b3 : invalid response from API request


#1

Hello,

When I try :
http://statistiques.zzz.fr/misc/cron/archive.php?token_auth=96cd934744d8c36712f456b70cdb85cc

I have this message :


INFO [2014-06-05 15:24:31] [277f9] ---------------------------

INFO [2014-06-05 15:24:31] [277f9] INIT

INFO [2014-06-05 15:24:31] [277f9] Piwik is installed at: http://statistiques.zzzz.fr/index.php

INFO [2014-06-05 15:24:31] [277f9] Running Piwik 2.4.0-b3 as Super User

ERROR [2014-06-05 15:24:39] [277f9] Got invalid response from API request: http://statistiques.zzzz.fr/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp. Response was '<br /> <b>Warning</b>:  Unexpected character in input:  '\' (ASCII=92) state=1 in <b>/home/zzzzbfgn/statistiques/console</b> on line <b>23</b><br /> <br /> <b>Parse error</b>:  syntax error, unexpected T_STRING in <b>/home/zzzzbfgn/statistiques/console</b> on line <b>23</b><br /> '

ERROR [2014-06-05 15:24:39] [277f9] The Piwik URL http://statistiques.zzzz.fr/index.php does not seem to be pointing to a Piwik server. Response was ''.

Php version is 5.5.13

What can I do ?
I have try on Piwik 2.3.0 and 2.4.0-b3, and I have the same problem

Best Regards


(Matthieu Aubry) #2

please check your server error log -> what error message do you see there?


#3

This error is caused by Piwik running the archival script using PHP version older than 5.3, which does not support namespaces (the error is about the the namespace separator in that particular file).

The most likely cause for this is a shared hosting setup, which supports multiple PHP versions. The archival script tries to run multiple scripts at the same time by invoking the PHP runtime. However, chances are, in such setup, it’s using the wrong PHP runtime (because Piwik cannot determine the correct runtime due to couple possible reasons). Thus, even though your script on the server is running appropriate PHP version, Piwik tries to run the archival script using wrong PHP version.

Piwik can run the archive script without invoking additional PHP runtimes, but I did not see an easy way to configure it. Thus my solution to this was:

Edit piwik/core/CliMulti.php and find


    private function supportsAsync()
    {
        return Process::isSupported() && $this->findPhpBinary();
    }

Replace it with:


    private function supportsAsync()
    {
        return false;
    }

For developers: I would suggest that CliMulti::findPhpBinary() should verify that the located PHP executable is capable of running Piwik.


#4

Hello,

The modification of CliMulti.php has solved the problem for me.

My Piwik is installed in a shared hosting, which supports multiple PHP versions.
If necessary I can do some other tests.

Best Regards
Didier


(Matthieu Aubry) #5

Thank you for the report! I have fixed this issue in: Cron core:archive: make sure the PHP cli binary is at least 5.3.2 · Issue #5343 · matomo-org/matomo · GitHub

If you sitll have problem after applying latest files, please let me know!


#6

Hello,
I have tested with Piwik 2.4.0-b6 and I have still the same problem.
Best regards
Didier


(Matthieu Aubry) #7

Hi Didier,
can you please create new forum thread with your problem? and please use 2.4.0-b7 which was just released. If you still have issue I’d like to investigate!


#8

Hi Matt,

Sorry for the delay, I was very busy last week.
I have tested 2.4.0-b8 : I have no problem now.
The problem is fixed.

Thanks a lot
Best regards
Didier