#1
  1. Contributing User
    SEO Chat Discoverer (100 - 499 posts)

    Join Date
    Sep 2003
    Posts
    144
    Rep Power
    16

    want to read in a 20mb .txt


    im having trouble reading in a 20mb .txt file into a php script.
    is ther some code workaround to buffer the data in?
  2. #2
  3. Contributing User
    SEO Chat Good Citizen (1000 - 1499 posts)

    Join Date
    Aug 2003
    Location
    San Diego • USA
    Posts
    1,274
    Rep Power
    17
    You reading it as a local file, HTTP form attachment or some other way?

    - Shawn
  4. #3
  5. Contributing User
    SEO Chat Discoverer (100 - 499 posts)

    Join Date
    Sep 2003
    Posts
    144
    Rep Power
    16
    Originally Posted by digitalpoint
    You reading it as a local file, HTTP form attachment or some other way?

    - Shawn
    from a local file
  6. #4
  7. Contributing User
    SEO Chat Good Citizen (1000 - 1499 posts)

    Join Date
    Aug 2003
    Location
    San Diego • USA
    Posts
    1,274
    Rep Power
    17
    What error are you getting? And what function are you using to read it in?

    - Shawn
  8. #5
  9. Contributing User
    SEO Chat Discoverer (100 - 499 posts)

    Join Date
    Sep 2003
    Posts
    144
    Rep Power
    16
    fgetcsv

    and also tried using other php file functions, i think the best bet is to split the file into small file
  10. #6
  11. Contributing User
    SEO Chat Good Citizen (1000 - 1499 posts)

    Join Date
    Aug 2003
    Location
    San Diego • USA
    Posts
    1,274
    Rep Power
    17
    Smaller chucks of the file are always going to be your best bet to be nice to the server...

    But what's the exact error you get when you try it?

    Try using the file_get_contents() function just to see if you an read it (it's the simplest file read function).

    - Shawn
  12. #7
  13. No Profile Picture
    Contributing User
    SEO Chat Discoverer (100 - 499 posts)

    Join Date
    Oct 2003
    Location
    Israel
    Posts
    411
    Rep Power
    16
    read in chuncks and see where it fails
  14. #8
  15. No Profile Picture
    Registered User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Apr 2004
    Location
    USA
    Posts
    9
    Rep Power
    0
    is it timing out on ya or what?
    is running the script from command line an option?
  16. #9
  17. Contributing User
    SEO Chat Good Citizen (1000 - 1499 posts)

    Join Date
    Aug 2003
    Location
    San Diego • USA
    Posts
    1,274
    Rep Power
    17
    Well it's not a limitation of the default setup of PHP. I recently had to so something where I had to read in a 2GB XML file. I was able to read it all in with a single pass, but the memory requirements were insane (as you can imagine), so I ended up doing it in 10MB chunks.

    - Shawn
  18. #10
  19. No Profile Picture
    Registered User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Apr 2004
    Location
    USA
    Posts
    9
    Rep Power
    0
    i agree with you shawn...
    the web server could be timing out though

    I too have read very large files in PHP... in fact I've got close to 50 scripts that run nightly doing just that.

    The point i was trying to make in my previous post was that if you have a shell account try logging on and doing it from a command prompt instead of through the browser
  20. #11
  21. Contributing User
    SEO Chat Good Citizen (1000 - 1499 posts)

    Join Date
    Aug 2003
    Location
    San Diego • USA
    Posts
    1,274
    Rep Power
    17
    Agreed... I didn't trigger it from a browser either... ran it from a shell.

    - Shawn

Similar Threads

  1. Stuck! cannot read STDIN from HTML submit
    By bkd52 in forum Web Design, Coding and Programming
    Replies: 0
    Last Post: Feb 3rd, 2004, 12:58 PM
  2. You Have To Read This... Google
    By sammyjane in forum Google Optimization
    Replies: 1
    Last Post: Jul 8th, 2003, 01:47 AM
  3. Mark this Forum Read
    By mario in forum Suggestions & Feedback
    Replies: 3
    Last Post: Jun 27th, 2003, 02:16 PM
  4. Can Googlebot read forms?
    By wirelesscove in forum Google Optimization
    Replies: 3
    Last Post: May 17th, 2003, 02:08 AM
  5. Googlebot php script = .txt log?
    By Nintendo in forum Google Optimization
    Replies: 9
    Last Post: Feb 23rd, 2003, 11:56 AM

IMN logo majestic logo threadwatch logo seochat tools logo