Jump to content

mkdir(name, 0777); permissions ?


koolaid

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.