Page redirects itself if script runs for too long

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
agsel
Forum Newbie
Posts: 4
Joined: Mon Oct 15, 2007 8:54 am

Page redirects itself if script runs for too long

Post 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?
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post 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.
agsel
Forum Newbie
Posts: 4
Joined: Mon Oct 15, 2007 8:54 am

Post 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.
Post Reply