Archive.php error - invalid response


#1

Hi everyone,

I am trying to execute the archive.php script prior to establishing as a scheduled task. Each time I run it I get this set or error messages:


SUMMARY OF ERRORS
Error: Got invalid response from API request: http://services.nconemap.com/piwi
/index.php?module=API&method=VisitsSummary.getVisits&idSite=1&period=month&date
last15&format=php&token_auth=XXXXXXXXXX&trigger=archiveph
. 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....

This occurs when attempting the report generation for month and year. The recommended fix is to increase the memory limit of php. I currently have it set to 3G. I can’t believe that it would need even more than that but am I wrong? Any other suggestions on how to get this to cleanly execute? I would like to be able to successfully run this a few times manually before setting it up for automation. Thanks.


(Matthieu Aubry) #2

What is the error in your server error log? Check in the FAQ for this error.


#3

Hi Matt. The error log reports:


[30-Oct-2013 22:04:06 UTC] PHP Fatal error:  Out of memory (allocated 1748238336) (tried to allocate 4104 bytes) in D:\piwik\core\DataTable.php on line 1050

I am running PHP 5.5 with opcache (if it makes a difference).

I should mention that I am trying to compile reports for the first time. I have imported data from January 1 of this year. The archive routine runs fine for day, week, but chokes when it gets to “month.” As I mentioned, I have the memory set at 3gig. If I raise that limit to 4gig and try to run archive.php I receive an immediate response of “the piwik url does not seem to be pointing to a piwik server.”

Would you have any suggestions? Thanks.


(Matthieu Aubry) #4

Yes you may need more memory at least temporarily. Also I would highly recommend to use 2.0 beta as it may improve memory usage.


#5

Thanks Matt. One question, I’ve seen some posts where there are memory settings within the config file of piwik (memory limit and memory limit when archiving). Should these be adjusted and how should they mimic (if at all) what is set in php.ini? You know already by my previous posts that I am not a php guy. However, I would really like to use this product and I just need to know the memory settings for Piwik and PHP that is optimal.

I will wait for your response and attempt again. If that fails, then I will upgrade.

Thanks again.


(Matthieu Aubry) #6

the PHP settings overwrite the piwik config settings (which are useful when you are not allowed to change memory setting eg. some shared hosting)


#7

Matt,

I have upgraded to v2 beta. Still seeing the same behavior. My current memory limit settings are:

php.ini
memory_limit = 8590000000 (8 gig)

config.ini.php
minimum_memory_limit = 8590000000
minimum_memory_limit_when_archiving = 8590000000

From the php error log, I have noticed that it always logs the at about the same size allocated (~1.5Gb) even though the setting is set much higher (8Gb).

Error log output snippet from three attempts to run archive.php:

Out of memory (allocated 1582301184) (tried to allocate 36 bytes)
Out of memory (allocated 1599340544) (tried to allocate 36 bytes)
Out of memory (allocated 1599864832) (tried to allocate 4104 bytes)

Is there any other place (e.g., MySQL, OS, etc.) where a setting could be causing this issue? I’m running out of ideas.

Configuration:
Windows Server 2008 R2
Intel Xeon 2.27GHz (2 processors)
16G RAM
PHP v5.5
Piwik v2 beta

Thanks for your help.

Brett


(Matthieu Aubry) #8

If you create a file test.php with <?php phpinfo(); ?>
do you see the right memory limit there?


#9

I ran into memory limit when processing the months as well, and I don’t have access to modify php.ini. My work around is to call archive.sh instead and set the memory limit there:


for TEST_PHP_BIN in php5 php php-cli php-cgi; do
  if which $TEST_PHP_BIN >/dev/null 2>/dev/null; then
    PHP_BIN=`which $TEST_PHP_BIN`
    break
  fi
done
if test -z $PHP_BIN; then
  echo "php binary not found. Make sure php5 or php exists in PATH." >&2
  exit 1
fi
PHP_BIN="$PHP_BIN -d memory_limit=4096M"