Undefined function memory_get_usage() ERROR

Hi Guys,

I have done a new download of the latest version of piwik and when I unzip it and browse to it in my browser I get the following error.

 Fatal error: Call to undefined function memory_get_usage() in \www\webroot\piwik\core\Timer.php on line 60 

Can anyone help me with this.

[quote=Bosbaba @ Mar 20 2009, 10:38 AM]Hi Guys,

I have done a new download of the latest version of piwik and when I unzip it and browse to it in my browser I get the following error.

 Fatal error: Call to undefined function memory_get_usage() in \www\webroot\piwik\core\Timer.php on line 60 

Can anyone help me with this.[/quote]
Sorry guys, I thought there was some errors in the code but I see the function is an actual php function. I will probably just have to install a module or something.

After a little bit of research I found out that you can’t use the memory_get_usage() function on a windows server
Any one now how I can by pass this so that I can use Piwik on a windows server.

Go opensource…
Go linux…

After digging around in the code a bit, the best solution I could come up with was to hack one of the core files a little. But the problem with it is that when upgrading you will have to redo the hack. Well any case here go’s

  1. You have to edit the following core file piwik_root_dir/core/Timer.php
  2. You will find the following function at the end of the class/file

	private function getMemoryUsage()
	{
		return memory_get_usage();
	}

  1. Replace it with this function

	private function getMemoryUsage()
	{
		if(function_exists('memory_get_usage')) {
			return memory_get_usage();
		} else {
			return FALSE; 
		}
	}

Well that will sort out the memory_get_usage(); problem temporarily, although it might have some memory usage impacked

what version of php are you running? this should be enabled by default from 5.2.1.

ok fixed http://dev.piwik.org/trac/changeset/996

vipsoft you’re right but piwik requires 5.1.3 so he must be using version in between

Yip, I am using PHP 5.2.0. Thank you for fixing this problem.

ok fixed http://dev.piwik.org/trac/changeset/996

Keep up the good work, it is an awesome project…