Reputation: 5183
I have
PHP Fatal error: Allowed memory size of 13241728 bytes exhausted (tried to allocate 24 bytes)
script (php) file is 400kb, output is 250kb
It opens (and unserializes) several files, each of them is no more then 8mb (total 32Mb).
For example:
while (($file = readdir($dir))!=false) {
$inf=file_get_contents($file);
$inf=unserialize($inf);
......
}
I'm using fast-cgi.
Why there's not enough memory when it should be enough?
I've been setting it in php.ini from 12Mb, 16, 32, 50 (same error) to 80Mb (wow it works)
Now it is set to -1
but I want to figure out why this happens and how to solve it (maybe unset some vars or something)
Upvotes: 0
Views: 557
Reputation: 1783
this is because php doesn t know how to properly unserialize $inf .
it's looping in a infinite way .
What is in the file you re trying to get ?
i think this is because you trying to save the unserialized variable into itself .
unserialize is recurisve ...
so you should do :
$variable = unserialize ( $inf );
instead of
$inf = unserialize ( $inf );
official php doc : http://php.net/unserialize
Upvotes: 1