CODE:
if (flock($fp, LOCK_EX))
{
fwrite($fp, serialize($this->_contents));
flock($fp, LOCK_UN);
}
ERROR:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 17805286 bytes).....
ERROR LINE:
fwrite($fp, serialize($this->_contents));
Any idea how to solve the issue? My site hosted on shared hosting so I have no chance changing memory settings.
Thanks
Most likely
serialize($this->_contents)is the problem.I generally tend to suggest to NOT use serialization to store things in a db or files.
You should split the data inside
_contentsand write them separately.