6

Can I set the following PHP configuration parameters as follows:

max_execution_time = 360 max_input_time 360

Is that safe and efficient ?

I actually need my user to upload large videos with the php-based Content Management System.

So, each video upload takes some minutes. Do I need to change both and the values are good ?

thanks

aneuryzm
  • 63,052
  • 100
  • 273
  • 488
  • in my opinion, this would depend largely on the average ISP speed of your users. So unless you have a finite definition of your users, we cannot say what are the most efficient values. – lock Sep 21 '10 at 08:10
  • If you're setting execution time > 300, you might also need to check your webserver configuration for a timeout setting as well... but any file that takes so long to upload is tking too long – Mark Baker Sep 21 '10 at 08:10
  • so what is your suggested value for let's say.. videos of 24MB to upload with PHP-based CMS ? – aneuryzm Sep 21 '10 at 08:13
  • @Patrick - use something like uploadify if your users are uploading such large volumes of data, or get higher bandwidth – Mark Baker Sep 21 '10 at 08:24
  • @Mark how would uploadify improve the situation? It's subject to the same limitations on the server's end, isn't it? – Pekka Sep 21 '10 at 08:36
  • @Pekka - I believe (correct me if I'm wrong) that it supports restarting an upload from the point where it failed... so even if the connection fails/times out, it'll start again from the point of failure on a retry (and this retry can be automated, making it transparent to the user, within the jQuery logic) – Mark Baker Sep 21 '10 at 08:47
  • @Mark sure, but that is no good if it's hitting the same limit all the time... Don't get me wrong, I *love* Uploadify, I just don't think it will help if you get a timeout due to an oversized file – Pekka Sep 21 '10 at 08:49
  • @Mark ah, now I understand what you mean! No, as far as I know, uploadify does not have "resume" functionality. It's just a plain file upload through other means – Pekka Sep 21 '10 at 08:52
  • @Pekka - My bad, although it looks like some other uploaders such as plupload (http://www.plupload.com/) do support this "chunking" feature – Mark Baker Sep 21 '10 at 09:07
  • @Mark interesting! Will have to look into that. That would be brilliant for uploads from shaky connections – Pekka Sep 21 '10 at 09:07
  • @both-of-you: I'm using Drupal upload plugins and I would like to just use Drupal for video uploading. I know that with FTP would be better, but I want to keep it simple for any customer. So again, what's your suggested value for let's say a video of 24MB ? What are the drawbacks of setting high values ? – aneuryzm Sep 21 '10 at 13:38

3 Answers3

9

In my understanding, you have to change neither.

If you just store the video files using move_uploaded_file, you will not need to increase your max_execution_time as upload time does not count towards execution time.

The manual says the following about max_input_time (emphasis mine):

This sets the maximum time in seconds a script is allowed to parse input data, like POST, GET and file uploads.

I have not tested this, but to me this sounds like it doesn't include the actual time the client spends uploading the file, just the time it takes to copy it to the temporary directory. I can't vouch for this though, and I can't find any info on it. The default of 60 seconds should be ample time to parse many hundreds of megabytes of files.

I'd recommend to find out the perfect value using real-life tests. If your connection is too fast, use a tool to slow it down. See this SO question for suggestions:

Network tools that simulate slow network connection

Community
  • 1
  • 1
Pekka
  • 442,112
  • 142
  • 972
  • 1,088
  • ok, so just to summarize: I only need to change post_max_size and upload_max_filesize ? thanks – aneuryzm Sep 21 '10 at 13:44
  • 2
    @Patrick, That's for byte limit. But if your webserver is slow, you may need to increase time limit ([`max_input_time`](http://stackoverflow.com/q/11387113/632951)) to parse those bytes that you receive. If you would like to operate on the bytes you've received, you would also need to increase the time limit for execution on the PHP side (`max_execution_time`) after the web server has finished its task. Lastly, control memory limits with `memory_limit` and GC with `session.gc_maxlifetime`. – Pacerier Feb 02 '15 at 13:14
  • Outstanding Solution – Hamad Jul 22 '18 at 19:26
3

In my case, max_input_time does affect my move_uploaded_file function. I failed to upload a 3GB file with default setting (max_input_time=60) but it succeeded with a larger value (max_input_time=300).

My PHP version is 7.2.19 on LAMP enviroment.

Liu Kc
  • 31
  • 1
  • 3
-1

By default my server has max_input_time as -1. I'm assuming that means infinite.

Jayden
  • 17
  • 1