Postponing execution time out

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

    Postponing execution time out

    Hi,

    I've got a problem with a script that needs about 1 minute to run as the
    max_execution_t ime is set to 30 seconds only. I don't have the rights to
    modify the max_execution_t ime parameter on the server.

    How can I postpone this time out ?

    Many thanks in advance,

    --
    alex


  • Erwin Moller

    #2
    Re: Postponing execution time out

    alex wrote:
    [color=blue]
    > Hi,
    >
    > I've got a problem with a script that needs about 1 minute to run as the
    > max_execution_t ime is set to 30 seconds only. I don't have the rights to
    > modify the max_execution_t ime parameter on the server.
    >
    > How can I postpone this time out ?
    >
    > Many thanks in advance,
    >
    > --
    > alex[/color]

    Hi Alex,

    Check


    Did you try set_time_limit( ) from your script?
    (Won't work if server runs in safe mode)

    If you cannot modify php.ini AND the server runs in safe mode, you have a
    problem, unless your provider will help.

    In that case: Try to make smaller tasks of the big job.

    Sequential:
    If your big job is sequential, you have to stop it after 20 secs or so (to
    be safe), SAFE THE STATE, then invoke a new PHP-script (or the same for
    that matter) that does the next 20 secs, etc.
    Of course you have to come up with a mechanism to store the state. This can
    be in a session or in a database, or a file. Whatever you think is
    suitable.

    Parralel job:
    In this case you can start up several requests at the same time.
    (eg: job1: email to users who name start with a-m, job2: n-z)
    Allthough it is very well possible that the jobs will both be slower because
    they run at the same time.
    So maybe you have to split up a parralel job as sequential too. :-)

    Just my 2 cents.

    Regards,
    Erwin Moller

    Comment

    • Alvaro G Vicario

      #3
      Re: Postponing execution time out

      *** alex wrote/escribió (Tue, 23 Aug 2005 14:45:46 +0200):[color=blue]
      > I've got a problem with a script that needs about 1 minute to run as the
      > max_execution_t ime is set to 30 seconds only. I don't have the rights to
      > modify the max_execution_t ime parameter on the server.[/color]

      You may find this useful, if you're allowed to use it:

      <?

      ini_set('max_ex ecution_time', 120); // 120 seconds
      ini_set('memory _limit', '64M'); // 64 MB

      ?>


      In either case, I highly recommend that you optimize your script. If it's a
      database query, skip fields you don't need, limit returned rows to needed
      records, use indexes, avoid unnecessary sortings... That can make as much
      difference as going from 1 minute to 10 seconds.

      --
      -- Álvaro G. Vicario - Burgos, Spain
      -- http://bits.demogracia.com - Mi sitio sobre programación web
      -- Don't e-mail me your questions, post them to the group
      --

      Comment

      Working...