I use Ubuntu 20.04. I have edited /etc/apache2/envvars to change the run user to “userA”:
When I run this PHP script from W3 Schools to upload a file, the upload works – but the owner of the file is not “userA” as I intend. It remains www-data. Yet this command:
sudo apache2ctl -S reports
User: name="userA" id=1002, as set in envvars. So why does www-data own the file, and not userA? What is determining file ownership? FWIW, the permissions of the directory into which the file is uploaded are 774, and ownership is userA:www-data. “Set UID” and/or “Set GID” on the directory had no impact either.