[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/docs/user/configuration/ -> configuring_file_upload_limits.diviner (source)

   1  @title Configuring File Upload Limits
   2  @group config
   3  
   4  Explains limits on file upload sizes.
   5  
   6  = Overview =
   7  
   8  File uploads are limited by a large number of pieces of configuration, at
   9  multiple layers of the application. Generally, the minimum value of all the
  10  limits is the effective one. To upload large files, you need to increase all
  11  the limits above the maximum file size you want to support. The settings which
  12  limit uploads are:
  13  
  14    - **HTTP Server**: The HTTP server may set a limit on the maximum request
  15      size. If you exceed this limit, you'll see a default server page with an
  16      HTTP error. These directives limit the total size of the request body,
  17      so they must be somewhat larger than the desired maximum filesize.
  18      - **Apache**: Apache limits requests with the Apache `LimitRequestBody`
  19        directive.
  20      - **nginx**: nginx limits requests with the nginx `client_max_body_size`
  21        directive. This often defaults to `1M`.
  22      - **lighttpd**: lighttpd limits requests with the lighttpd
  23        `server.max-request-size` directive.
  24    - **PHP**: PHP has several directives which limit uploads. These directives
  25      are found in `php.ini`.
  26      - **upload_max_filesize**: Maximum file size PHP will accept in a file
  27        upload. If you exceed this, Phabricator will give you a useful error. This
  28        often defaults to `2M`.
  29      - **post_max_size**: Maximum POST request size PHP will accept. If you
  30        exceed this, Phabricator will give you a useful error. This often defaults
  31        to `8M`.
  32      - **memory_limit**: For some uploads, file data will be read into memory
  33        before Phabricator can adjust the memory limit. If you exceed this, PHP
  34        may give you a useful error, depending on your configuration.
  35      - **max_input_vars**: When files are uploaded via HTML5 drag and drop file
  36        upload APIs, PHP parses the file body as though it contained normal POST
  37        parameters, and may trigger `max_input_vars` if a file has a lot of
  38        brackets in it. You may need to set it to some astronomically high value.
  39    - **Storage Engines**: Some storage engines can be configured not to accept
  40      files over a certain size. To upload a file, you must have at least one
  41      configured storage engine which can accept it. Phabricator should give you
  42      useful errors if any of these fail.
  43      - **MySQL Engine**: Upload size is limited by the Phabricator setting
  44        `storage.mysql-engine.max-size`.
  45      - **Amazon S3**: Upload size is limited by Phabricator's implementation to
  46        `5G`.
  47      - **Local Disk**: Upload size is limited only by free disk space.
  48    - **Resource Constraints**: File uploads are limited by resource constraints
  49      on the application server. In particular, some uploaded files are written
  50      to disk in their entirety before being moved to storage engines, and all
  51      uploaded files are read into memory before being moved. These hard limits
  52      should be large for most servers, but will fundamentally prevent Phabricator
  53      from processing truly enormous files (GB/TB scale). Phabricator is probably
  54      not the best application for this in any case.
  55    - **Phabricator Master Limit**: The master limit, `storage.upload-size-limit`,
  56      is used to show upload limits in the UI.
  57  
  58  Phabricator can't read some of these settings, so it can't figure out what the
  59  current limit is or be much help at all in configuring it. Thus, you need to
  60  manually configure all of these limits and then tell Phabricator what you set
  61  them to. Follow these steps:
  62  
  63    - Pick some limit you want to set, like `100M`.
  64    - Configure all of the settings mentioned above to be a bit bigger than the
  65      limit you want to enforce (**note that there are some security implications
  66      to raising these limits**; principally, your server may become easier to
  67      attack with a denial-of-service).
  68    - Set `storage.upload-size-limit` to the limit you want.
  69    - The UI should now show your limit.
  70    - Upload a big file to make sure it works.
  71  
  72  = Next Steps =
  73  
  74  Continue by:
  75  
  76    - configuring file storage with @{article:Configuring File Storage}; or
  77    - returning to the @{article:Configuration Guide}.


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1