API: getPageUrl returns weird characters in the json response



I have a strange issue with the API (Piwik 2.1). I’m using the Actions.getPageUrl method. It working correctly when date range is not too big (30 days), but as soon as I use a larger range, the response take a while and when the response finally arrives, I get those ‘things’ at the end of the respond:

Ge�QhA�Тr��F���Iu�aPl���-֚ 04lΚ�Ga��#��P��(vԄ��l�?ml��ʇD�n.��r�����N

making the response unusable. On the server side, I have this error:

Connection reset by peer: FastCGI: comm with server "/var/www/domain.com/analytics/cgi-bin/php5.external" aborted: read failed
Handler for fastcgi-script returned invalid result code 1

I doubled check the server config, the timeout is set to 600sec, the memory limit is set the 512M, and I know that it’s not a timeout or a memory limit because I get a clear message when it is the case.

Any idea what’s wrong with this?


(Fabian Becker) #2

Hi there,
can you check the php-fpm timeout? There’s a timeout when a php process gets killed when it doesn’t return anything for a certain amount of time. This looks like part of a gzipped response.




yes I double checked it and it is set to 600sec. Fast-cgi timeout is set to 1800sec… but the problem occurs before that.
In fact we got this result when mod_deflate is deactivated. When it was activated we just got nothing (empty response, no header, nothing).





after several tests and config adjustments, I still have the problem. I tried to:

  • Increase PHP memory limit to 2048M (no effect)
  • Increase Apache, PHP, Fastcgi timeout (all are set to 1800sec)
  • Remove gzip compression

Now I’m wondering, is it possible that data are corrupted for a certain date range? Can I delete archive tables without loosing all my data?