Page 1 of 1

php cannot read huge input file

Posted: Wed Aug 27, 2008 12:39 am
by antoniobanjeras
hi,

i'm new to php. i hv this code that read from input file into array. i managed to read input file (.txt file) up to 9MB in size. right now, my code cannot read if the input file is more than 9MB, eventhough i've changed the php.ini setting into these values:

max_execution_time = 120
max_input_time = 180
memory_limit = 128M
post_max_size = 50M
upload_max_filesize = 20M

If the size is more than 9MB, there's no error msg, nothing. just that, the display table is blank. Pls help! :banghead:

Re: php cannot read huge input file

Posted: Wed Aug 27, 2008 3:31 am
by jmut
Maybe should explain what you're after...using fopen you can get/process your file in portions. Is this 9MB text file :roll:

Re: php cannot read huge input file

Posted: Wed Aug 27, 2008 4:01 am
by antoniobanjeras
jmut wrote:Maybe should explain what you're after...using fopen you can get/process your file in portions. Is this 9MB text file :roll:
i need to read from input file, roughly about 10MB in size. the content separated by tab ('\t") and newline, and display in html table. i'm using multidimensional array for easier display for each table cells, plus, easier to do pagination.

pls advise!

Re: php cannot read huge input file

Posted: Sat Sep 13, 2008 12:12 pm
by sergeyba
Include the folowing lines somewhere inside your code (prefered at the beginning of your script):

ini_set("upload_max_filesize","THE_SIZE_YOU_WANT");
ini_set("post_max_size","THE_SIZE_YOU_WANT");
ini_set("memory_limit","THE_SIZE_YOU_WANT");


the above will change you php.ini configuration on the run specific for your site and no contact with the administrator of your server is needed.
the first two lines are exactly what you need.
the third although, is more sofisticated and should be used only if you are doing some "on the fly" processing and loading the file into memory, lets say like pictures resizing or something like that.