PHP Fatal error: Allowed memory size of 2147483648 bytes exhausted


I’ve been receiving the following error when running the auto-archive script, either interactively or from the cron:

ERROR CoreConsole[2014-05-28 13:22:17] [c811d] Got invalid response from API request: Response was 'PHP Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 64 bytes) in /apps/piwik/core/DataTable.php on line 1155

I’m currently running Piwik version 2.3.0, Apache 2.2.15, and PHP 5.3.3.

I’ve experienced this error for many weeks now and it seems to have started after upgrading to Piwik 2.1. The error is the same, always complaining about DataTable.php line 1155. I’ve tried several of the beta versions since. The error seemed to briefly stop for a about a week, but, has returned and persists even after the latest update to 2.3.0 so I don’t think this is a PHP issue or memory issue as other posts have suggested, though I have tried increasing the memory assigned to PHP and to the server itself, but, this did not help. Additionally, the auto-archive script had been running without issue for many months with the same Apache and PHP versions. Only once I upgraded to Piwik 2.1 did these errors begin.

Please advise on how to correct this error.


Did you check your memory setting if it was relying on suhosin memory? Maybe just increase there.

Maybe the apache memory setting?

No, I’m not using suhosin and I’m not too familiar with apache memory settings; it’s set to what the apache configs default to.

Since I’ve been running the same Apache and PHP configs since I first installed Piwik over a year ago and since everything has worked fine up until about a month ago, I’m really not sure this is an actual memory issue. The only thing which has changed are the Piwik versions and if a newer release had a need for higher memory settings in PHP, Apache, etc I would expect this to be clearly documented somewhere.

Additionally, I’ve tried incremental increases of the server memory and PHP memory up to 8GB and with each increase, the bytes exhausted would increase to whatever the memory limit was at that moment. I suspect if I continued testing with 32GB, 64GB, etc the results would be the same. Nowhere do I see documentation stating that 8GB or greater is required for Piwik.

Thanks for the suggestions but I really think the issue lies within Piwik. Any other thoughts?

what about deleting the contents of tmp folder and trying to run the script after?

what python version is on the server?

I removed all contents from the tmp folder but the same errors persist.

Python 2.6.6 is installed on the server.

Can you try and upgrade the python to 2.7.1 at least? I think it is the recommeneded minimum when used by piwik. I dont think it affects cron but perhaps might help.

can you paste the memory setting from the php.ini here?

Do you happen to have any htaccess files that are constrianing things?

I just tried updating to Python 2.7.6 but the error persists. Additionally, the latest version of python available for RHEL 6 is 2.6.6. Many core OS functions rely on python and do not yet support the 2.7 branch. For example, with 2.7.6 installed, it broke yum. I’ve since reverted back to 2.6.6. I am able to install 2.7.6 alongside the existing version, but, this would only be useful if there is a way to tell Piwik only to point to this particular version of python. Regardless, this didn’t seem to help.

Here are the memory_limit settings I’ve tried incrementally in php.ini:
;memory_limit = 128M
;memory_limit = 512M
;memory_limit = 1024M
memory_limit = 2048M

No, I’m not using any htaccess files.

Thanks again for your continued input.

Would your site that you are tracking happen to be on wordpress? Are you using the piwik wordpress plugin?

No. The particular site which throws the error is actually using the log import utility.

Take a look at the threads below… maybe user permission?,114351,114351#msg-114351,112662,113041

Allowed memory size of XXX

See FAQ: Piwik reports this error and fails: "Fatal error: Allowed memory size of X bytes exhausted (tried to allocate X bytes)". What should I do? - Analytics Platform - Matomo

@ lesjokolat: Not sure those apply. To clarify, my log importing cron jobs have always run successfully. Only when doing auto-archiving are these PHP errors reported.

@ matt: I’ve already tried increasing php memory several times, even up to 8GB. Doesn’t matter how much memory I give PHP, the errors still occur. Other threads indicate this doesn’t solve the problem for them either, leading me to think this isn’t really a PHP memory issue.

If you get error Allowed memory size of XXX it really means your PHP is not configured with a memory of more than X bytes.

eg. you must increase the memory allocated to PHP. Update your php.ini file to increase your memory limit in the file


and at


Then restart server

You can try increase php memory limit in php.ini located in etc/php.ini or .htaccess located in your website folder.

Change to something like 512mb or 1GB and restart httpd to see if the error is gone.

In my case, I use Magento and I follow this instruction to fix that How to fix PHP memory Fatal errors allowed memory size in Magento