Addtitional info:
I\'m running this from the command line. CentOS 6, 32GB Ram total, 2GB Memory for PHP.
I tried increasing the memory limit to 4GB, but now I get a Fatal
I solved the problem. It turned out to be somewhat unrelated to the php code.
The program I am writing downloads .xls
, .xlsx
, and .csv
files from email and FTP. The .xls
file that was causing the memory overflow was downloaded in ASCII mode instead of Binary.
I changed my default to binary mode, and added a check that changes it to ASCII mode for .csv
files.
I still find it strange that the program creates a 2GB string because of that. If there are no line breaks in the binary file, then I can see perhaps how the entire file might end up in one string. But the file is only 286KB. So, that's strange.