Archive.php: Got invalid response from API request (The response was empty)

Same here. Didn’t solved the problem.

Maybe it has something to do that I’ve setup to use


piwik/misc/cron/archive.sh

for archiving?

With Piwik Beta 2.2.1-b3 I got no more errors now since yesterday. Hope now it is fixed.

Please upgrade to 2.2.1-beta4 which should fix some issue.

if you still have a problem, please create a new forum thread as this one is getting too long!

@Matt I applied the patch, still not working

require_once PIWIK_INCLUDE_PATH . ‘/core/testMinimumPhpVersion.php’;
date_default_timezone_set(‘UTC’);
require_once file_exists(PIWIK_INCLUDE_PATH . ‘/vendor/autoload.php’)

CRON JOB OUTPUT:

INFO CoreConsole[2014-05-02 21:00:00] [ba5fd] ---------------------------
INFO CoreConsole[2014-05-02 21:00:00] [ba5fd] INIT
INFO CoreConsole[2014-05-02 21:00:00] [ba5fd] Piwik is installed at:
http://domain.com/piwik/index.php
INFO CoreConsole[2014-05-02 21:00:00] [ba5fd] Running Piwik 2.2.0 as Super User
INFO CoreConsole[2014-05-02 21:00:00] [ba5fd] ERROR: Got invalid response from API
request:
http://domain.com/piwik/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp.
The response was empty. This usually means a server error. This solution to this
error is generally to increase the value of ‘memory_limit’ in your php.ini file.
Please check your Web server Error Log file for more details.

[Piwik\CronArchiveFatalException]

The Piwik URL http://domain.com/piwik/index.php does not seem to be pointing to a
Piwik server. Response was ‘’.

core:archive [–url=“…”] [–force-all-websites] [–force-all-periods[=“…”]]
[–force-timeout-for-periods[=“…”]] [–force-date-last-n=“…”]
[–force-idsites[=“…”]] [–skip-idsites[=“…”]] [–disable-scheduled-tasks]
[–xhprof] [–accept-invalid-ssl-certificate]


php.ini has

; http://php.net/memory-limit
memory_limit = 512M

SSH SU Works:

/usr/local/bin/php /home/bla/domains/domain.com/public_html/piwik/console core:archive --url=http://domain.com/piwik

System info:

FreeBSD 8.3-RELEASE
Apache 2.4.7
Php 5.3.28
DirectAdmin 1.45.0

update to 2.2.1 RC 1
Still no luck

INFO CoreConsole[2014-05-05 09:28:00] [95644] ---------------------------
INFO CoreConsole[2014-05-05 09:28:00] [95644] INIT
INFO CoreConsole[2014-05-05 09:28:00] [95644] Piwik is installed at:
http://domain.com/piwik/index.php
INFO CoreConsole[2014-05-05 09:28:00] [95644] Running Piwik 2.2.1-rc1 as Super User
INFO CoreConsole[2014-05-05 09:28:00] [95644] ERROR: Got invalid response from API
request:
http://domain.com/piwik/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp.
The response was empty. This usually means a server error. This solution to this
error is generally to increase the value of ‘memory_limit’ in your php.ini file.
Please check your Web server Error Log file for more details.
INFO CoreConsole[2014-05-05 09:28:00] [95644] ERROR: The Piwik URL
http://domain.com/piwik/index.php does not seem to be pointing to a Piwik server.
Response was ‘’.
Error in the last Piwik archive.php run:
The Piwik URL http://domain.com/piwik/index.php does not seem to be pointing to a
Piwik server. Response was ‘’.

Here is the full errors output:


INIT
Piwik is installed at: http://domain.com/piwik/index.php
Running Piwik 2.2.1-rc1 as Super User
ERROR: Got invalid response from API request:
http://domain.com/piwik/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp.
The response was empty. This usually means a server error. This solution to this
error is generally to increase the value of ‘memory_limit’ in your php.ini file.
Please check your Web server Error Log file for more details.

Ok, we can hopefully find why it does not work yet for you.

When you do like


lynx  http://domain.com/piwik/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp.

can you see the actual API response OK?

Hi Matt,

I don’t know what you mean with “lynx” but when I paste the url in a browser this is the response

a:40:{s:9:“nb_visits”;s:8:“Bezoeken”;s:16:“nb_uniq_visitors”;s:16:“Unieke bezoekers”;s:10:“nb_actions”;s:6:“Acties”;s:20:“nb_actions_per_visit”;s:17:“Acties per bezoek”;s:16:“avg_time_on_site”;s:20:“Gem. tijd op de site”;s:11:“bounce_rate”;s:12:“Bounce Ratio”;s:15:“conversion_rate”;s:15:“Conversie ratio”;s:5:“label”;s:6:“Waarde”;s:4:“date”;s:5:“Datum”;s:16:“avg_time_on_page”;s:19:“Gem. tijd op pagina”;s:14:“sum_time_spent”;s:55:“Totale tijd gespendeerd door de bezoekers (in seconden)”;s:16:“sum_visit_length”;s:55:“Totale tijd gespendeerd door de bezoekers (in seconden)”;s:12:“bounce_count”;s:7:“Bounces”;s:22:“bounce_count_returning”;s:42:“Aantal bounces voor terugkerende bezoekers”;s:11:“max_actions”;s:34:“Maximaal aantal acties per bezoek.”;s:21:“max_actions_returning”;s:45:“Hoogste aantal acties in een terugkeer bezoek”;s:29:“nb_visits_converted_returning”;s:40:“Aantal conversies terugkerende bezoekers”;s:26:“sum_visit_length_returning”;s:63:“Totale tijd besteed door de terugkerende bezoeker (in seconden)”;s:19:“nb_visits_converted”;s:24:“Bezoekers met conversies”;s:14:“nb_conversions”;s:10:“Conversies”;s:7:“revenue”;s:9:“Inkomsten”;s:7:“nb_hits”;s:15:“Paginaweergaves”;s:15:“entry_nb_visits”;s:13:“Binnenkomsten”;s:22:“entry_nb_uniq_visitors”;s:15:“Unieke ingangen”;s:14:“exit_nb_visits”;s:10:“Vertrekken”;s:21:“exit_nb_uniq_visitors”;s:16:“Unieke uitgangen”;s:18:“entry_bounce_count”;s:7:“Bounces”;s:17:“exit_bounce_count”;s:7:“Bounces”;s:9:“exit_rate”;s:10:“Exit ratio”;s:26:“sum_daily_nb_uniq_visitors”;s:35:“Unieke bezoekers (dagelijks bedrag)”;s:32:“sum_daily_entry_nb_uniq_visitors”;s:34:“Unieke ingangen (dagelijks bedrag)”;s:31:“sum_daily_exit_nb_uniq_visitors”;s:35:“Unieke uitgangen (dagelijks bedrag)”;s:16:“entry_nb_actions”;s:32:“Acties na het hier in te voeren.”;s:22:“entry_sum_visit_length”;s:81:“Totale tijd gespendeerd door de bezoekers (in seconden) na het hier in te voeren.”;s:9:“nb_events”;s:21:“Totaal gebeurtenissen”;s:15:“sum_event_value”;s:13:“Totale waarde”;s:15:“min_event_value”;s:15:“Minimale waarde”;s:15:“max_event_value”;s:15:“Maximale waarde”;s:15:“avg_event_value”;s:17:“Gemiddelde waarde”;s:20:“nb_events_with_value”;s:29:“Gebeurtenissen met een waarde”;}

in your server can you try to execute “lynx URL” or wget “URL” and see if the response is correct?

This is the output:

server2:admin /usr/home/admin>wget http://domain.com/piwik/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp
[5] 42377
wget: No match.
[6] 42378
method=API.getDefaultMetricTranslations: Command not found.
[7] 42379
format=original: Command not found.
[8] 42380
serialize=1: Command not found.
trigger=archivephp: Command not found.
[8] Exit 1 serialize=1
[7] Exit 1 format=original
[6] Exit 1 method=API.getDefaultMetricTranslations
[5] Exit 1 wget http://domain.com/piwik/index.php?module=API
[4] Exit 1 serialize=1
[3] - Exit 1 format=original
[1] + Exit 1 wget http://domain.com/piwik/index.php?module=API
server2:admin /usr/home/admin>

add the quotes around the URL

Sry.
Hope this helps:

server2:admin /usr/home/admin>wget “http://domain.com/piwik/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp
–2014-05-05 15:53:30-- http://domain.com/piwik/index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp
Resolving … xx.xx.xx.xx
Connecting to … (…)|xx.xx.xx.xx|:80… connected.

HTTP request sent, awaiting response… 200 OK
Length: 2035 (2.0K) [text/plain]
Saving to: ‘index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp’

100%[================================================================================================================================================================>] 2,035 --.-K/s in 0s

2014-05-05 15:53:30 (409 MB/s) - ‘index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp.’ saved [2035/2035]

server2:admin /usr/home/admin>edit index.php?module=API&method=API.getDefaultMetricTranslations&format=original&serialize=1&trigger=archivephp
[1] 70632
edit: No match.
[2] 70633
method=API.getDefaultMetricTranslations: Command not found.
[3] 70634
format=original: Command not found.
[4] 70635
serialize=1: Command not found.
trigger=archivephp.1: Command not found.
[4] - Exit 1 serialize=1
[3] - Exit 1 format=original
[2] - Exit 1 method=API.getDefaultMetricTranslations
[1] + Exit 1 edit index.php?module=API
server2:admin /usr/home/admin>

now open this file starting with index.php -> what does it contain?

I allready posted that, it’s the second (last) quote in the message.

Same problem here on FreeBSD with php 5.4.27 (another user also reported the problem with FreeBSD here, so maybe this is related)

Running


/usr/local/bin/sudo -u www /usr/local/bin/php /usr/local/www/piwik/console core:archive --url=https://piwik.mysite.org/piwik/

from console works just fine. Also running


fetch "https://piwik.mysite.org/piwik/index.php?module=API&method=API.get&idSite=1&period=day&date=last52&format=php&token_auth=XXX&trigger=archivephp"

downloads the file correctly and also includes the data in a key-value format similar to json…

However, running the very same command via cron as


5 * * * * /usr/local/bin/sudo -u www /usr/local/bin/php /usr/local/www/piwik/console core:archive --url=https://piwik.mysite.org/piwik/

gives the error:


INFO CoreConsole[2014-05-05 21:05:06] [d8c88] ERROR: Got invalid response from API request: https://piwik.mysite.org/piwik/index.php?module=API&method=API.get&idSite=1&period=day&date=last52&format=php&token_auth=XXX&trigger=archivephp. The response was empty. This usually means a server error. This solution to this error is generally to increase the value of 'memory_limit' in your php.ini file. Please check your Web server Error Log file for more details.

This was all working ok before Piwik 2.2

can you try upgrade to latest RC from: Index of /

If you still experience the issue then, I’d be interested to get SSH access to your piwik + steps to reproduce + link to this post, by email at matt@piwik.org

Could it be a php setting as per this older topic?

http://forum.piwik.org/read.php?2,113069

@lesjokolat The link you just posted, points to the beginning of this thread

I am afraid that I will not be allowed to give you access to the machine, which is a matter of security policies. Maybe someone else on this thread can.

Buggah sorry for bad link ref.

Maybe the php version is an issue can you upgrade php to something higher? 5.4 or 5.5? Even 5.33 would be an improvement as prior versions seemed to be buggy.

Also perhaps checking and upgrading python version might help.