Page 1 of 1

CGI Application Timout

Posted: Mon Aug 08, 2005 8:14 am
by icarpenter
Hi... I'm not shure if this is a PHP thing or not but I am running quite an intensive script which keeps timeing out...I have tried altering what is the CGI Timeout in IIS to no avail...is there anything I need to do in PHP.ini.

I am using XP and IIS 5.1.

Thanks Ian.

Posted: Mon Aug 08, 2005 8:46 am
by Grim...
The php timeout can be changed in the php.ini, or you could try changing your code to make it run faster :)

Posted: Mon Aug 08, 2005 10:53 am
by Ambush Commander
Some scripts have the nature of taking a long time to finish. In that case, use:

Code: Select all

set_time_limit(0);
For an unlimited time limit, or replace 0 with whatever amount of seconds you want to pass before the script times out.

More information here: http://us2.php.net/manual/en/function.s ... -limit.php

Posted: Sun Aug 14, 2005 2:43 am
by icarpenter
Thanks for that I have tried this but it still keeps timing out after about 4 minutes...This could be an IIS thing I guess.

I'm going to try moving over to Apache to see if the result varies...

It seems to me that the server is dropping the connection but I cant seem to extend the CGI timout function??? 8O

Posted: Sun Aug 14, 2005 9:11 am
by Ambush Commander
Try making it a command line script... When you operate from the command line, you get to see the output as it comes. It requires a bit of modification (no HTML) but it's pretty good for very long tasks.

Posted: Sun Aug 14, 2005 9:16 am
by nielsene
You'll need to look in the IIS configuratio. Apache is normally configured to timeout after 5 minutes and this server time-outs trumps the PHP timeout, so you;ll have to increase the server's timeout in order for the PHP one to take effect.

Posted: Sun Aug 14, 2005 9:18 am
by Ambush Commander
Yup. Exactly. So command line bypasses Apache and lets you do the script an arbitrary amount of time.

Posted: Sun Aug 14, 2005 9:27 pm
by icarpenter
Got it...

I upgraded to apache and increased the timeout from 300 to 9999. incidently this feature didn't seem to work in IIS.

I think I will try to run this script from the command line in the future as the output could be more helpfull...

Thanks all!
Rgds Ian. :D