Fatal error: Allowed memory size
Posted on 2006-04-22
I'm using a php script to open and read a data file using function fgetcsv; this works for data files up to the size of about 6MB but fails with a file of 7.98MB. I realise the default memory_size is 8MB and I'm wanting to open a 22MB text data file on the webserver. I've tried increasing the memory_size using both of the following techniques:
ini_set("memory_limit","50M"); - placed at the top of the script file
php_value memory_limit "50M" - placed in an .htaccess file
Both of these methods seem to cause the error message to register the increase, but it still fails. A typical error message:
Fatal error: Allowed memory size of 52428800 bytes exhausted (tried to allocate 31 bytes) in /home/account/public_html/directory/functions.php on line 117
Looking for some specific advice please, not links to other questions unless they have info specific to my problem. Maybe there's a better way to read the csv file, or read it in stages (line by line would take a long time there's 15000 records).