koolaid Posted July 9, 2009 Share Posted July 9, 2009 Hi guys, i am having trouble with permissions after I make a directory. It makes my directory then writes my .xml file to it exactly how i would like it to, but then when i ftp in i cannot delete that directory. I am on a linux server. Does anyone have any insight for me? I am making a new directory and writing an xml file to it, like so <?php $var1 = $_POST["stringXML"]; $varrandom = $_POST["randomString"]; $folder = "./pending/$varrandom/"; if(!is_dir($folder)) mkdir($folder, 0777); $mode = file_exists($folder.'pending.xml')?'a':'w'; $fp = fopen($folder.'pending.xml',$mode); fwrite($fp, "$var1"); fwrite($fp, "\r\n\r\n"); fclose($fp); ?> Thanks in advance Quote Link to comment Share on other sites More sharing options...
allenskd Posted July 9, 2009 Share Posted July 9, 2009 It's probably because Apache is running as root (or different group/user), so it creates the file that it only can manage. So you can't directly use ftp but still can manage it using your script, http://php.net/unlink or SSH to chown the file Then again thats as far as I get, lets see if other users have a different way to manage this Quote Link to comment Share on other sites More sharing options...
koolaid Posted July 9, 2009 Author Share Posted July 9, 2009 I think you are exactly right. i have been digging and that is all i can come up with. How would i change the group to allow ftp changes (when executing the creation of the file)? Quote Link to comment Share on other sites More sharing options...
allenskd Posted July 9, 2009 Share Posted July 9, 2009 Well, you could check php.net/chown and try, but if it change... that's really a bad sign. You could also build an interface with your script to manage the files and continue managing them. Or you can log in to your SSH and chown them Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.