I'm having issues with creating folders and uploading files to them in PHP safe mode.
If I log into my server using an FTP program, and create a folder with permissions 0777, the folders are given owner "USER" (don't know the UID), and I am freely able to use PHP scripts to successfully move_uploaded_file() and unlink() files in the folder.
However, I now want PHP to be able to create folders on the fly. So, I mkdir() and then chmod() the folders to 0777. This works. But I've noticed that the folders are given owner "apache" (UID 50), and when I try to move_uploaded_file() and unlink() files in the folder, I get the error
SAFE MODE Restriction in effect. The script whose uid is 500 is not allowed to access FOLDER PATH owned by uid 50
I've tried chown("FOLDER", "USER"), since the folders created by USER via FTP work just fine, but that returns the error that it can't find the UID for "USER". I've tried chown("FOLDER", 500), but that returns the error "chown(): Operation not permitted".
This seems a little silly that PHP can write to folders I create in an FTP program, but not folders it creates itself. Is there a way to work around this on the code level, or do I need to contact my server? If I need to contact my server, what should I ask them to do, specifically? Do they need to change "apache"'s UID, or PHP's UID, or USER's UID, or what?