Apache2 php Big File Handling (for ownCloud6 file upload/download)

By default, ownCloud limits file uploads and downloads to a maximum of 512MBytes in one gulp. Can you take that higher? How large can you go?…

The file size limit for uploads/downloads is set in the underlying php parameters “upload_max_filesize” and “post_max_size”. With those, for consistency also good is to set proportionately the “output_buffering” parameter…

So… How to do that?…

If the installation permits ownCloud to edit the website root “.htaccess” file and that file is active/honoured, then simply set the upload limit graphically on the ownCloud admin page, for example:

ownCloud6 file handling upload size limit option

 

Note if active, that overrides adding into the vhosts config for your ownCloud website the parameters:
 

<IfModule mod_php5.c>
	php_value memory_limit 1G
	php_value upload_max_filesize 8G
	php_value post_max_size 8G
	php_value output_buffering 8192
</IfModule>

(Those are for an 8GByte upload limit. The increased “php_value memory_limit” parameter may well be no longer needed.)

And those values in vhosts override the values set in the “php.ini” file for Apache2:
 

memory_limit = 1G
output_buffering = 8192
file_uploads = On
post_max_size = 8G
upload_max_filesize = 8G

One additional thing that should be set in one of those three places is:

upload_tmp_dir = /var/www/your.website.tld/htdocs/owncloud/data/upload-tmp

and ensure the “upload-tmp” directory exists and with the correct permissions.

Also, at least for Gentoo if using mysql, ensure there is the php entry for:

mysql.default_socket = /var/run/mysqld/mysqld.sock

Note that some older web browsers and client systems are limited to a maximum file size of 2GBytes. See: ownCloud6 – Dealing with Big File Uploads

For long duration connections or for many multiple files uploads/downloads, you may also need to add for the php:
 

max_file_uploads = 200
max_input_time = 3600
max_execution_time = 3600
session.gc_maxlifetime = 3600

(Max 200 files and one hour in one gulp.)

Note that in a “.htaccess” or vhosts file those become:

<IfModule mod_php5.c>
	php_value max_file_uploads 200
	php_value max_input_time 3600
	php_value max_execution_time 3600
	php_value session.gc_maxlifetime 3600
</IfModule>

Finally, restart Apache2 to pick up the new settings and enjoy your cloud with big files!

Leave a Reply