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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make dir 1

Status
Not open for further replies.

namida

Programmer
May 29, 2003
101
AU
Hi.

I'm trying to make a directory through PHP. I tried using the mkdirs function that was posted in PHP website and also tried directly testing the mkdir function.

This is the test without the function


$mk=mkdir("/home/echo $mk;

With or without the mkdirs function The directory is created, but I can't browse it. It will keep on giving me 550 error.

I can't change the chmod either. But I can change other dir's chmods.

I have tried port 700 and it's the same result. Any idea?

I have also asked the administrator but I'm guessing it's my code..


Regards,

Namida
 
The webserver user creates the directory. As such, the webserver user owns the directory and only the owner and root are able to change the mode.

//Daniel
 
I see..
I understand what you mean. So is there any way that I can make it so I can browse through the directory?

Sometimes I might have to do a little admin with the directory or see whether my code works and it's writing the file.

Or do I really have to make them all through web interface?

thanks!


Regards,

Namida
 
Thanks I have read the url. I think I'm getting the user wrong

This is my code now

$mk=mkdir("/home/echo $mk;
$uid [name] = "namida";
$uid [uid] = 91;
$uid [gid] = 91;
$uid [gecos] = "namida";
$uid [dir] = "/";
$uid [shell] = "/sbin/nologin";

print_r(posix_getpwuid(fileowner("/home/
$ch=chown("/home/bus8646/ $uid);
echo $ch;

but I'm still getting a permission denied. Is it supposed to be 777 when I create the file? or do I have to chmod it again before i chown


Regards,

Namida
 
Well, I obviously didn't remember it correctly.
A regular user is not allowed to [tt]chown[/tt], only the super user is.
The only way is really to create the directories yourself, and have the webserver create the files only, or to maintain it through a web interface too.

//Daniel
 
i see thanks.

Because I was allowing users to upload files and so the directories are only created when they started uploading 1 file. One directory per user with the user's name.

But I guess I could just pile everything up in one directory.





Regards,

Namida
 
yes i had same problem but i solved this by using filename like user_filename and you will solve at least the same file for diferent users issue.

________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top