Getting PHP upload error 6 because of $HOMEDIR/$user/tmp permissions

hey mee.feed,

in scenarios where you do not use multi-php apache runs php as mod/prefork. with that there is a need to tell apache to switch users for the php processes it spawns.

this should be done via mod-ruid2 or alternatively via mpm-itk. I just checked should be available in ubuntu 20.04 - maybe you can verify that at least one of these is installed (dpkg -l).

which apache2-template do you use? something custom? make sure the according directives for either ruid2 or itk are in there. essentially every php process should not run as www-data but instead as the correct user.

that said, you want to make sure that your (php) files truly belong to the correct owner! with I mean, check if you unpacked stuff fro a zip or tgz via shell console as admin/root/whatever, that these files have their owner changed to the proper user they are under. otherwise a working ruid/itk would switch to the wrong user as well, becvause of the wrong owner.

TL;DR; if the file owners are correct and apache has a module to switch to that owner as user, there is no need to adjut permissions on the tmp folder. it will work out of the box.

1 Like