PHP Excel Memory Limit of 2GB Exhausted reading a 286KB file

后端 未结 1 1634
予麋鹿
予麋鹿 2021-01-24 10:07

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

相关标签:
1条回答
  • 2021-01-24 10:36

    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.

    0 讨论(0)
提交回复
热议问题