Enter your question or search term
eg. 'what are my email server settings'
How do PHP safe mode Group ID (GID) restrictions affect file uploads?
Your directories are by default owned by [your_primary_username]:users (the [your_primary_username] user in the 'users' group).
However, when a file is uploaded it is created by the Apache process and by default the ownership is set to www:www (meaning the 'www' user, in the 'www' group). To overcome this issue, chmod your upload directories to 2777 so that any files created in that directory inherit the group ownership of the parent directory.
The governing rule of the GID implementation of safe mode is that from within PHP any file access you make has to be within or below your home directory (/home/y/your_username), and the file you're attempting to open/write/read etc has to be owned by 'users'. If you want to copy/delete/move files from within PHP you must have group ownership on the files.
Also, you must use the move_uploaded_file() function to move the freshly uploaded file to your upload directory. You can not use fopen() or copy() to move the file to your upload directory.