Sorry for resurrecting this old thread, but I'm having a somewhat similar issue. I have this php script that uses curl to open several http pages, so it takes a long time to run... sometimes it may take 2 hours to complete.
It was designed to be a background task, so no screen output, and there lies the problem. If I modify it so there is output echoed every few seconds on the browser, then the script run flawlessly, even if it takes two hours. However if I disable the screen output, the script will timeout after exactly 5 minutes (I checked by writing the output to a file).
I searched the forums and came across this topic, where it's said to increase the Initial Request Timeout, however mine is set to 60 seconds and the script timeouts after 300 seconds, so I don't think the problem will be solved by increasing this setting.
Any ideas where should I change any settings? Can I set a timeout of 0 for this particular script? I'm running v3.3.22 and PHP 5.2.6.