Dealing with large files
To handle large file uploads you need to adapt the following PHP settings. The value should be the size of largest file you wish to upload, for example if you want to upload files as large as 50MB you need the following settings.
- upload_max_filesize: 50MB
- post_max_size: 51MB
- memory_limit: 55MB
- max_input_time: -1 (default) or a very high value example 600 (10 minutes)
You need to make sure that
memory_limit is larger then
post_max_size which should be slightly larger then
Not all hosts allow to change PHP configuration values through
php.ini files or
.htaccess files. Sometimes only some items can be changed and others can't.
For example, your PHP memory limit is set to 8M, but you want to double that. In your
.htaccess file, you have this line:
php_value memory_limit 16M
To make sure a change you made is actually making any difference, you can use Joomla's System Info (Help > System Info > PHP Information).
Now search for
memory_limit on that page. In the 'Master Value' column on the right, you see the original value of 8M. In the left 'Local Value' column, you see the actual value. If this isn't your new value of 16M, then your host doesn't support overriding this value. You'll have to ask your host to change it.
Some resources on how to set up PHP to allow large uploads:
Make sure Joomla's sessions lifetime is long enough to allow for large (or slow) uploads.
- Global Configuration
- System tab
- Set 'Session Lifetime'
A good value is at least 30min, if you are dealing with large uploads.
PHP uploads files to it's temporary directory as specified by the upload_tmp_dir setting. The directory must be writable by whatever user PHP is running as. If not specified PHP will use the system's default.
In Unix, the /tmp directory will often be a separate disk partition, often the size of the partition is 16MB. When you are trying to upload large files make sure this partition is big enough, or change your
upload_tmp_dir settings to point to a different directory.
Please be aware that if the directory specified in
upload_tmp_dir is not writable, PHP falls back to the system default temporary directory. If open_basedir is on, then the system default directory must be allowed for an upload to succeed.
Depending on which web server you are using, you might need to change the configuration as well to allow large file uploads. If you are unsure which type of server you are running or how to modify its configuration, ask your web host to change it.
The Apache webserver has a
LimitRequestBody configuration directive that restricts the size of all POST data regardless of the web scripting language in use. You will need to change this to a larger value or remove the entry altogether.
More changes may be needed depending on how Apache talks to PHP:
- Apache with mod_fcgid: Set the
FcgidMaxRequestLenvalue to a high enough value.
You need to increase the
client_max_body_size directive in your Nginx configuration.
Google Doc Viewer
Please see our Known issues help article.