Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Safe Mode / File ownership problem

Status
Not open for further replies.

thomasveil

Programmer
Mar 7, 2005
6
DE
Hi

I am currently working on a project that requires xml documents to be created and then saved in directories which are also created as needed.

The problem i am running up against is the safe_mode feature of php.

When i use a script to create a new directory or xml file the owner is set to the apache server (on my host). This means that when i want to save xml files to a newly created folder or make alterations to newly created xml files, php safe_mode blocks access because the uid is not the same as the file/directory owner.

Is there any work around for this that anyone knows (i can't seem to find one). This project is designed to be portable so that it can be simply installed on any host so the workaround needs to take this into account.
 
This is a known problem. While it is possible to write files into existing folders, as soon as you have the Apache user create a directory you are out of luck since the UID is different.
If you can devise a way to create a folder/file and then take ownership, it should be resolved. Copying as yourself to a different filename changes ownership (at least on *NIX type OS).
Theoretically you could setup a PHP script that creates files and folders using an internal FTP mechanism which would allow to autheticate to the server as yourself and create files/folders owned by you.
 
thanks for the info.

I'm going to give the ftp method a try i think, although it's not my ideal solution, i think it's the only way that will work.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top