Page 1 of 1

Page redirects itself if script runs for too long

Posted: Mon Oct 15, 2007 9:03 am
by agsel
I have a page, where users can upload pdf-files. System generates different kind of pdf and jpg-files from given pdf (for previews). Recently I noticed, that for some PDFs it takes too much time and white page is shown after process. I made some debugging and saw that after about 60 seconds of running page redirects itself to the same address and does all the process again.

I have tried to set the time limit longer, but it doesn't change anything. I made the whole process shorter (less previews for one file) and it worked fine. If it only was a timeout problem, it wouldn't bother me so much. But the redirection makes things messy. This means, that for each uploaded pdf, the system does the whole process twice. And for the both times it actually fails (it generates for example 4 out 5 previews fine).

This only has happened for one certain pdf so far. But the bigger the files are, the more time it takes to process them. And I think this problem will probably happen for different pdfs aswell.

So, I'm out of ideas. Any suggestions? Do you need more information?

Posted: Mon Oct 15, 2007 2:48 pm
by Kieran Huggins
Check out: http://ca3.php.net/set-time-limit - maybe your script is timing out?

If you're doing this on a shared host they might be killing your process so you don't interfere with other users. And they'd be right to do so.

Make sure this is on your own machine.

Posted: Tue Oct 16, 2007 1:17 am
by agsel
Thanks for your reply.

Machine is not mine. That's not an option currently to change the machine to my own.

I've tried set_time_limit(600) or something. When I try something else which takes time, for example made a long for-cycle or sleep, it works fine for 5 mins or so and continues after that. But when I try exec (that's what I use to run system commands), it won't let me run the script more than 60 seconds.