Parsing a 100mb txt file.

Discussion in 'PHP' started by JosS, Jun 18, 2007.

  1. #1
    I have a script that runs through a text file and spits out certain things within the text file, removes duplicates etc.

    The script used to work fine, but each couple days this .txt file increases as it is a server log. At the moment it is 100mb, and when the script on it locally on wamp server it times out with a 30 second timeout.

    I then went into PHP.ini and changed this 30 second time out to something like 500 but it still times out and says 30 second time out.

    Is there any way around this?
     
    JosS, Jun 18, 2007 IP
  2. Evoleto

    Evoleto Well-Known Member

    Messages:
    253
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #2
    Set that timeout value to 0 (zero), it will become unlimited.
     
    Evoleto, Jun 18, 2007 IP
  3. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #3
    Or put set_time_limit(0); in your code. I prefer this so I don't have to change settings back and forth when doing such processes.
     
    krt, Jun 18, 2007 IP
  4. jazz7620

    jazz7620 Banned

    Messages:
    357
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Not everyone has access to php.ini, specially in shared host environment.
    This is what I use on top of my php page for running larger scripts. I hope it helps.
    <?
    ini_set("max_execution_time",3000);
    ini_set('memory_limit','100M');
    ?>
     
    jazz7620, Jun 18, 2007 IP
  5. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #5
    Access the script via command prompt (CMD/SSH).

    Peace,
     
    Barti1987, Jun 18, 2007 IP