HumHub - Permissions - Uploads (Hint: Make /var/www/humhub/uploads writable for the Webserver/PHP!)

Description of my issue

How can I change permission?
Permissions - Uploads (Hint: Make /var/www/humhub/uploads writable for the Webserver/PHP!)

It’s displayed in the Adminstration-Menu > Information > Prerequisites

But I can upload files that are smaller than 1 MB.
Maybe it is related to another bug:

My YunoHost server

Hardware: VPS bought online
YunoHost version: 4.3.6.2
I have access to my server : Through SSH
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

If you login via SSH, you can look up the current permissions for example by using ls -l. I don’t have humhub, but to get an idea,

$ ls -l
total 48
dr-xr-x--- 14 element        www-data      4096 Feb 18 13:33 element
...
drwxr-xr-x  2 root           root          4096 Oct  3 13:13 html
...
drwxr-x--- 17 opensondage    www-data      4096 Dec 15 18:54 opensondage
...
drwxr-xr-x  5 wordpress      wordpress     4096 Mar 17 19:49 wordpress
...

The directories are owned and writable by various system users (the first rwx behind d). They are accessible by their groups, but read only (r-x, read and execute/enter directory).

You could have a look who owns the directory /var/www/humhub/uploads ; I would expect it is set correctly by the Yunohost installation process, also because you are able to upload small files.

In php.ini there is a setting that sets the size for file uploads, the first result that I found is at Stackoverflow:

There are quite a few php.ini files on my Yunohost, because different versions of PHP can coexist on the same system. You’ll need to find out which PHP is used by HumHub, and change the corresponding php.ini (or change them all), for example /etc/php/7.3/cli/php.ini

The upload_max_filesize = 2M, but I can upload only 1 MB.
I have changed it to 20 MB, but it did not have any effect.
HumHub uses PHP 7.3.33, so I think it’s the right php.ini?

I don’t think this is the right place. In the settings it says: PHP reported a maximum of (upload_max_filesize): 1024 MB

I’ve changed the permissions for /var/www/humhub/uploads to 777, but is it good? Now the check mark is green, but no other effect.

Pity that it does not work yet!

That would be the ini for 7.3 indeed, accidentally the same in my example :stuck_out_tongue:

Is the screenshot from HumHub? Then you’d say the upload size is not the problem.

For anything web-facing, 777 is never good. I think 755 should be right: r/w for the owner, readable for the group and others.

Sorry to not be of any more help!

I think the settings of 1024 MB come from /etc/php/7.3/fpm/pool.d/humhub.conf

php_admin_value[upload_max_filesize] = 1G
php_admin_value[post_max_size] = 1G

But it has no effect of the 1 MB problem.

Did you restart php service?
777 is a bad idea

I changed permissions for /var/www/humhub/uploads to 755 and owner to humhub (it was root before)

Restart php and nginx have no effect.

Can this help?

But I have no idea where to set this at yunohost?

the file you’re looking for is located in /etc/nginx/conf.d
it will be named the same domain name followed by .conf
you’ll add client_max_body_size 1024m;
like explained here : What is client_max_body_size in Nginx
restart nginx
be careful not to change anything else

thx jarod5001!
I have now understood the concept of conf files :wink:
https://stackoverflow.com/questions/28476643/default-nginx-client-max-body-size

I’ve added the line

client_max_body_size 1024M;

in humhub.conf in /etc/nginx/conf.d/[domain].d/in the section

location / {
            ...
            client_max_body_size 1024M;
            }

than service nginx restart

And everything works fine.

You can limit the possible upload size in the HumHub settings:
Administration > Settings > Advanced > Files: Maximum upload file size (in MB)

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.