PHP script doesn't execute completely!

Discussion in 'PHP' started by Mr.Submit, Dec 20, 2006.

  1. #1
    Hi,
    I wrote a simple script that reads content from large file (by file_get_contents) and puts to analyzing routine. The analyzing process takes some minutes. My problem is that the routine always stops before completing analyzing, even I set max_execute_time in php.ini to 24 hours and call the set_time_limit function inside the analyzing circles.
    Can you tell me did I miss some thing here?
    Thank you very much.
     
    Mr.Submit, Dec 20, 2006 IP
  2. yugu

    yugu Peon

    Messages:
    98
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Your host may limit execution time forcely.
    If the host is shared then more probably it ends script due to heavy resource consumption.
     
    yugu, Dec 21, 2006 IP
  3. Mr.Submit

    Mr.Submit Active Member

    Messages:
    301
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    85
    #3
    Thanks for reply.
    Yes, it's shared host. I think you're right.
    Do you recommend some solution?
     
    Mr.Submit, Dec 21, 2006 IP
  4. clancey

    clancey Peon

    Messages:
    1,099
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I do not think there is a solution to your problem if you are using shared hosting and you are determined to run that process on their machine.

    In that days when I used shared hosting, I always did processor intensive work on my local computer and uploaded the results to the shared host, which only served pages. That may be the only way to ensure that this file analysis gets done.

    A more flexible shared hosting solution is a VPS. In this case, you rent a virtual machine, which is on a computer offering other virtual machines to other people. You get more full control over your cirtual machine, including the ability to install software and tweak all the configuration files.
     
    clancey, Dec 21, 2006 IP
  5. B.V.E.

    B.V.E. Peon

    Messages:
    106
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    They set the limit for a good reason of course if it's shared hosting, but you could consider the following solution if you only have to run the script yourself once in a while:

    *Split your routine and process up in multiple parts. (I.e.: only analyze xxxxx-bytes at a time).
    *Use javascript to walk through each part/step... (Just echo a redirect javascript after each step is finished to call the next step)

    Not really host-friendly, and you need to keep your browser open, but it's a good temporary solution I often use myself for large database scripts on shared hosts...
     
    B.V.E., Dec 21, 2006 IP
  6. Mr.Submit

    Mr.Submit Active Member

    Messages:
    301
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    85
    #6
    Thank you all very much.
    This may work for me.
    Regards.
     
    Mr.Submit, Dec 21, 2006 IP