Problem with execution time (I think)

Discussion in 'PHP' started by danzor, Dec 7, 2007.

  1. #1
    I've written a script which will parse iTunes library files (XML) and record the contents into a database.

    It works perfectly fine with small files (couple of megabytes). However a file around 10mb seems to make the script grind to a halt.

    I've set the following at the top of my script:
    ini_set("max_input_time", 300);
    ini_set("max_execution_time", 300);
    PHP:
    And i've changed upload_max_filesize and post_max_size in php.ini to 20mb (20M).

    The script doesn't output anything, nor does it perform any of the database queries, it's just a blank screen.
     
    danzor, Dec 7, 2007 IP
  2. tonybogs

    tonybogs Peon

    Messages:
    462
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try this :)

    echo ini_get('memory_limit');

    It may be set to something low like 8mb. If you are reading the entire file contents into a variable (memory) this will exceed the limit before you even have a chance to process it.

    You can up the limit like this:

    ini_set('memory_limit', 16000000);

    Then try again.

    Good Luck :)
     
    tonybogs, Dec 7, 2007 IP
  3. buldozerceto

    buldozerceto Active Member

    Messages:
    1,137
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    88
    #3
    try setting the timeout

    set_time_limit(0);
     
    buldozerceto, Dec 7, 2007 IP
  4. danzor

    danzor Peon

    Messages:
    208
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks for the help.. i'd changed some values in php.ini, but apparently the php.ini was in the wrong place (/etc/php.ini instead of /usr/local/lib/php.ini).
    Changed the path and it worked fine, thanks anyway though.
     
    danzor, Dec 7, 2007 IP