Jump to content

Allowed Memory Error when loading large file.


hellonoko

Recommended Posts

Using the below code:

 

<?php

$dictionary = fopen('US.dic','r');

while (!feof($dictionary))
{
$lines[] = fgets($dictionary, 24004096);
}

fclose($dictionary);

?> 

 

I receive this error:

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 24004097 bytes) in C:\www\dic\d.php on line 8

 

The file is 1,185K

 

I am using WAMP for server. Do I need to change some settings or is there a better way to load large files.

 

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.