long process and timeout

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob Bedford

    long process and timeout

    Some of my code has a long process, and my ISP limits the scripts to 30
    seconds.

    Now, I must absolutely create a file with some string (simply a number and
    an email), then process any line with some long operations.
    If the script timeouts, then calling the script again should start when it
    finished.

    How to achieve that ?

    I tough about deleting the last line every time it's processed and then the
    process is done when the file is empty.
    There is also the possibility to create a tracker file where I save the last
    processed number, but it's longer to do.

    Any tip ?


  • Erwin Moller

    #2
    Re: long process and timeout

    Bob Bedford wrote:
    [color=blue]
    > Some of my code has a long process, and my ISP limits the scripts to 30
    > seconds.
    >
    > Now, I must absolutely create a file with some string (simply a number and
    > an email), then process any line with some long operations.
    > If the script timeouts, then calling the script again should start when it
    > finished.
    >[/color]

    <snip>

    Did you try to overrule that setting with ini_set?
    You can use it at the start of your script and set another value for the
    script timeout.

    (read here)


    Try that first, if just might work.

    Regards,
    Erwin Moller

    Comment

    • gron0022@gmail.com

      #3
      Re: long process and timeout



      Bob Bedford wrote:[color=blue]
      > Some of my code has a long process, and my ISP limits the scripts to 30
      > seconds.
      >
      > Now, I must absolutely create a file with some string (simply a number and
      > an email), then process any line with some long operations.
      > If the script timeouts, then calling the script again should start when it
      > finished.
      >
      > How to achieve that ?
      >
      > I tough about deleting the last line every time it's processed and then the
      > process is done when the file is empty.
      > There is also the possibility to create a tracker file where I save the last
      > processed number, but it's longer to do.
      >
      > Any tip ?[/color]

      Comment

      • juglesh

        #4
        Re: long process and timeout



        Erwin Moller wrote:[color=blue]
        > Bob Bedford wrote:
        >[color=green]
        > > Some of my code has a long process, and my ISP limits the scripts to 30
        > > seconds.
        > >
        > > Now, I must absolutely create a file with some string (simply a number and
        > > an email), then process any line with some long operations.
        > > If the script timeouts, then calling the script again should start when it
        > > finished.
        > >[/color]
        >
        > <snip>
        >
        > Did you try to overrule that setting with ini_set?
        > You can use it at the start of your script and set another value for the
        > script timeout.
        >
        > (read here)
        > http://nl2.php.net/manual/en/function.ini-set.php[/color]

        or, if you are allowed to use .htaccess files, put one in the folder
        that your long running script is in. Try this, it works great for me:

        # php_value name value
        php_value post_max_size 666M
        php_value upload_max_file size 10M
        php_value max_execution_t ime 16666

        Comment

        Working...