|
Posted by Erwin Moller on 08/23/05 15:58
alex wrote:
> Hi,
>
> I've got a problem with a script that needs about 1 minute to run as the
> max_execution_time is set to 30 seconds only. I don't have the rights to
> modify the max_execution_time parameter on the server.
>
> How can I postpone this time out ?
>
> Many thanks in advance,
>
> --
> alex
Hi Alex,
Check
http://nl2.php.net/function.set-time-limit
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
[Back to original message]
|