2

I am trying to load a serialized php object from a 3.14gb file to unserialize it again as an object. I have a very specific calculation purpose. That is why I am trying to do this.

I can't use file_get_contents as it truncates the content. (it gives a warning, that is how I know that).

When I try to read and append that data manually to an empty string, this time I get Fatal error: String size overflow.

I have 16gb ram and ssd disk and I use OS X 10.11.1 memory_limit is -1. I know that it will use swap, so I accept it to be slow. Currently I couldn't figure out a way to load this data back to php. Do you have any ideas? Is there anything that can be done at this moment?

frankish
  • 6,738
  • 9
  • 49
  • 100
  • I believe you're hitting a limit for 32 bit string lengths PHP - I believe PHP7 supports 64bit though, might be worth https://github.com/php/php-src/blob/php-7.0.0alpha2/UPGRADING (Support for strings with length >= 2^31 bytes in 64 bit builds.) – BenOfTheNorth Nov 19 '15 at 18:04
  • is it possible to chunk into multiple string?? so it can store more than 2GB ?? – Andrew Nov 19 '15 at 18:10
  • I suppose there is no standard method to fulfill your request. But you may implement `unserialize()` method that will consume stream. – max Nov 19 '15 at 18:31

0 Answers0