Max upload size and file permissions

Hi,

I have set up nextcloud on my debian.
To set up files and folders permissions, I have used the proposed script in the installation guide (https://docs.nextcloud.com/server/10.0/admin_manual/installation/installation_wizard.html)

But doing that, I can no more set the Max upload size in the administration panel.
(textbox is now disable and I get the message :“Missing permissions to edit from here.”)

I guess it is just a file or folder permission issue.

Does anybody know how to fix it ?

Thanks

I imagine it may be due to the permissions set on the htaccess file (read, no write) which would render it impossible to update the lines:

php_value post_max_size xxM
php_value memory_limit xxM

This can be undone with sudo chmod 744 /path/to/nextcloud/.htaccess

Thanks Jason,

I had to change pemissions to 764 for both the files .htaccess and .user.ini

Max Upload Size is then correctly saved to in .htaccess and .user.ini

But when I come back to the Administration/additional settings page, the Max Upload size displayed is still 2 MB, despite another value is stored in .htaccess and .user.ini ! (I wonder why 2 MB !?)

It’s 744 on my installs and seems to work, but as long as you’re progressing that’s all that matters.

2MB is default for PHP, try restarting Apache, changing and saving it and if it changes back to 2MB again you may need to update your php.ini file:

/etc/php/apache2/php.ini on my Ubuntu server, yours may vary.

Look out for:
post_max_size =
upload_max_filesize =

Be sure to set post_max_size to higher than upload_max_size.

Maybe the values you entered are wrong in terms of a wrong format.
What exactly did you enter?

By the way: I only defined the value in the .user.ini and it works for me.
For security reasons I made changes to these files directly and removed write permission for group on these files. Yes, I can’t change the max upload size on the Web page, but this value doesn’t need to be changed often, so I don’t care :wink:

@Jason
You are right. It comes from the php.ini file

@Schmu
I entered 4G, and I get 4G in .htaccess and .user.ini
So I follow you recommendation: values directly entered in the files and write permissions removed.

Thank to both of you

2 Likes

I enter 50G in .user.ini, but the admin control panel showing 10GB.

server info:
Nginx
PHP 5.6

.user.ini

upload_max_filesize=50G
post_max_size=50G
memory_limit=512M
mbstring.func_overload=0
always_populate_raw_post_data=-1
default_charset='UTF-8'
output_buffering=0

.htaccess

<IfModule mod_php7.c>
  php_value upload_max_filesize 50G
  php_value post_max_size 50G
  php_value memory_limit 512M
  php_value mbstring.func_overload 0
  php_value default_charset 'UTF-8'
  php_value output_buffering 0
  <IfModule mod_env.c>
SetEnv htaccessWorking true
  </IfModule>

I’m also curious as my NC 11 default 511Mb is set in .user.ini and .htaccess my php.ini has 2Mb and still i can upload 1,5Gb trough website and webdav

NC 11.0.0.10 (stable)
PHP 7.0.8
mySQL Ver 15.1 Distrib 10.0.28-MariaDB
Apache/2.4.18 (Ubuntu)

Maybe it’s different on snap, but I can’t change the setting and my .htaccess file is 644. But owner is root (is that a snap root or actual root?), so I guess it still could be a problem with the webserver access. How do I find out more about how to solve this?

My .htaccess and .user.ini files were owned by root:http so I just changed their permissions from 644 to 664. I’ve considered submitting a request to the package maintainer for my distro to either change the ownership or permissions on those files.