1

In my php script larger file takes longer to upload and its bound by max_execution_time. when max_execution_time was set to 60 and i was uploading files under 1MB there was no problem. once i uploaded a file over 3MB i kept getting a blank screen with no error on it.

Dont worry all upload limits are set and yes php display errors is on. The only way i was able to determine the problem was when i set my max_execution_time to 360.

Once i did that there was time out and upload went through successfully.

my problem is that users are allowed to upload much later files and there is no way of nowing how long to set max_execution_time for.

If it is set really high, like how i have it set to 360 seconds, then that means in theory every php process can take up to 360 seconds to execute, which can be very bad.

Someone please help me. This is a file hosting script.

thanks.

john
  • 41
  • 2
  • 1
    Upload time does not count toward max_execution_time. What is your script doing with the uploaded file? – Pekka Dec 15 '10 at 13:47

2 Answers2

1

Change the max execution time only when users are uploading files.

ini_set('max_execution_time', 360);
Mike B
  • 31,886
  • 13
  • 87
  • 111
  • little note: keep in mind the "max_execution_time" starts *after* the upload to the webserver is completed and php is invoked to parse the file. [See Pekka's post for details](http://stackoverflow.com/a/4220463/620410) – Tapper Oct 15 '12 at 08:24
  • In my case I find that max_execution_time is reached also in case of big uploads, but I cannot understand why. I did not resolve adding ini_set in the php script becase the max_execution_time error is thrown at the very first row of the script (before the ini_set). The only solution for me is to set it in the php.ini or in apache .htaccess. – Tobia Feb 17 '16 at 16:40
0

I believe setting the 'max_input_time' php.ini variable will only affect the parsing of input variables, which includes POSTed file uploads.