Welcome Guest, Not a member yet? Register   Sign In
script time out
#1

[eluser]deco10[/eluser]
Hi

I'm running a script that does a large database update. It times out after about 30 seconds and thats no long enough.

I have set_time_limit(90); at the top of the script, but that doesn't seem to make any difference.


Suggestions?
#2

[eluser]eoinmcg[/eluser]
probably not recommended in a production environment but

Code:
set_time_limit  ( 0 );

means that no timeout limit is imposed, unless of course your web server timesout. i think apache will do so after 5 mins by default.

try using the profiler class to see if you can reduce any bottlenecks. run the database update via a cron job at some time you know the server won't be busy...
#3

[eluser]deco10[/eluser]
I have that.
I'm executing insert statements in a for loop. It stops after about 30 seconds.
#4

[eluser]eoinmcg[/eluser]
possibly your webserver is timing out or, assuming you're on a hosted server, you are not allowed to change the value of set_time_out. 30 secs is the php default so this may explain why your script keeps stopping at this point. if this is the case you'll need to get in touch with your host...
#5

[eluser]deco10[/eluser]
I am root.
I don't want to change it for all scripts though, just this one.
#6

[eluser]eoinmcg[/eluser]
are you sure that the set_time_out is taking effect?

try setting it and calling php_info()

otherwise what kind of setup do you have? i have no problems with this on apache2, php5 on a variety of linux boxes...




Theme © iAndrew 2016 - Forum software by © MyBB