I'm trying to open/read a 6MB CSV file with PHP like so:
$lines = file("/path/to/my/file.csv");
But I'm getting the following error:
PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 6461150 bytes) in /path/to/php_file.php on line 488
As you can see, our PHP memory settings are set to 1GB (dedicated server, not limited by any shared hosting package etc).
My question is should a 6MB CSV file really be using over 1GB when read into a variable (array). I'm just a bit confused because I'm sure I've opened larger CSV files with PHP before without problems on this server.
Shouldn't make a difference but we're using PHP 5.3 on Ubuntu 12.04 Server.