Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can server timeout be controlled by code?

I have used a tutorial to create a PHP script to upload files to a server. It works beautifully for images and small files < 10mb but over that size it fails. I believe that this may be due to a server timeout. The question is, if I am correct in my assumption is there a way to tell the server to wait until the file has uploaded?

Of course there may be another issue I haven't thought of, according to the script I have the large uploads aren't producing an error and the "success" text is displayed!

Any helpful advice would be appreciated :)

like image 953
Ar77 Avatar asked May 24 '11 11:05

Ar77


3 Answers

Try this: http://php.net/manual/en/function.set-time-limit.php

like image 55
Olive Avatar answered Sep 22 '22 06:09

Olive


You can set the timeout using set_time_limit($seconds)

If you set $seconds to 0, the server won't time out - but use this very carefully!

like image 35
Adam Hopkinson Avatar answered Sep 23 '22 06:09

Adam Hopkinson


In PHP there's a function called set_time_limit() which you can use to set how long it'll take before PHP terminates due to running to long. Be careful with it though because setting it to 0 can leave php processing waiting around forever and eat up your server resources.

You can also set this directive in php.ini or from apache .htaccess files.

There is also max_input_time in php.ini

like image 34
NA. Avatar answered Sep 23 '22 06:09

NA.