move_uploaded_file and permissions issue
Moderator: General Moderators
move_uploaded_file and permissions issue
I have recently set up a webserver, and I'm in the process of moving all the sites I admin over to this server. Some of these sites have administrative backends that allow the user to upload files. Initially the upload wasn't working, but I managed a quick fix. Basically the upload folders are owned by the admin of the virtual host for each site. The group attached is the group associated with that virtual host. However, apache is run as root. So by default apache/php doesn't have the permissions to move a file from the tmp folder into the folder on the virtual host. I fixed this initially by adding root to the virtual hosts group and giving the folder group write permissions. I would prefer a solution that will be uniform for all my virtual hosts and not require me to add root to a new group every time I add a virtual host and make those folders group writeable. Is there a standard configuration option I'm missing when setting up allow file upload and virtual hosts?
Re: move_uploaded_file and permissions issue
ok. i think i was wrong. apache is run by the group www-data which is automatically part of the group for each virtual host i created. so by enabling group write permissions it should have fixed the problem. I'd prefer to not have to do that though. Is there a way around that?