This might be useful when serving file downloads or uploads using PHP.
Run Internet Information Services (IIS) Manager and select your site.
Uploads
Request Filtering Settings in IIS
Now go to Request Filtering and click Edit Feature Settings… in right pane. In the new window go to Maximum allowed content length (Bytes) and type your maximum value for uploads.
Maximum value is 4294967295 (4.294967 GB)
PHP settings
Best way to setup your PHP for only one site (not polluting global config) is to create .user.ini file in root of your project.
You should put there special config declarations. These are variables crucial for large file uploads/downloads:
; The maximum number of files allowed to be uploaded simultaneously.
max_file_uploads = 400
; The maximum size of an uploaded file.
upload_max_filesize = 2048M
; Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize.
post_max_size = 2048M
; This sets the maximum amount of memory in bytes that a script is allowed to allocate. It also affects file uploading. Generally speaking,memory_limit should be larger than post_max_size
. memory_limit = 4096M ; This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser. max_execution_time = 10800
Downloads
Go to root of your server configuration and find FastCGI Settings, select version of PHP you’re using and click it two times.
Only value you should be interested in is Request Timeout. You should hack i to your needs. It simply means how long client might be connected to your server (it’s in seconds – 3600 is one hour).
Bonus
I’ve written a small script to test long downloads so you can easily test your settings in production:
File: dummy_download.php
------------------------