473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Postponing execution time out

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
Aug 23 '05 #1
2 1806
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
Aug 23 '05 #2
*** alex wrote/escribió (Tue, 23 Aug 2005 14:45:46 +0200):
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.


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

<?

ini_set('max_execution_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
--
Aug 24 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: cournape | last post by:
Hi there, I have some scientific application written in python. There is a good deal of list processing, but also some "simple" computation such as basic linear algebra involved. I would like to...
5
by: Johannes Lebek | last post by:
Hi there, lately, I experienced a strange thing on my DB2 V8.1 on Windows: Some queries took a very long time. A snapshot discovered the following: Number of executions = 47...
7
by: Tim Quon | last post by:
Hi Is there any function to get the current time so I can calculate the execution time of my code? What all is in the time.h and sys/times.h? Thanks Tim
38
by: vashwath | last post by:
Might be off topic but I don't know where to post this question.Hope some body clears my doubt. The coding standard of the project which I am working on say's not to use malloc.When I asked my...
3
by: iam980 | last post by:
Hello All. We have tested following SQL script from query analyzer: -- Script begin DECLARE @I int; SET @I = 1; WHILE @I < 10000000 BEGIN SET @I = @I + 1; END -- Script end
3
by: vashwath | last post by:
Hi all, I have written program for calculating the execution time of a function.Any critics (on the method of calculating execution time) are welcome. #include <stdio.h> #include <time.h>...
2
by: Ina Schmitz | last post by:
Hi NG, does IBM Universal Database 8.2 make any difference between actual and estimated execution plans like in SQL Server ("set showplan_all on" for estimated execution plan and "set statistics...
17
by: romixnews | last post by:
Hi, I'm facing the problem of analyzing a memory allocation dynamic and object creation dynamics of a very big C++ application with a goal of optimizing its performance and eventually also...
6
by: Mikhail Kovalev | last post by:
I'm using set_time_limit() to set maximum execution time. Is there a way to check how much time is left at any time during the execution itself?
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.