Jump to content


Photo

Permission problems with mkdir()


  • Please log in to reply
4 replies to this topic

#1 Yesideez

Yesideez
  • Members
  • PipPipPip
  • Advanced Member
  • 2,334 posts
  • LocationDevon, UK

Posted 19 August 2006 - 11:20 AM

I've created a folder using FTP and this:
mkdir("profiles",666);

Both times the folder is created no problem. I need my script to create extra folders inside "profiles" on the fly as users register yet when I try this:
mkdir("profiles/oliveri",666);

I get this error message:
Warning: mkdir(profiles/oliveri): Permission denied in /home/randgigs/public_html/profile.php on line 8

The value 666 in mkdir() is for read & write access.

Can someone tell me where I'm going wrong please?

Many thanks.
Not a pro just an enthusiast :)

if (empty($coffee)) {$coffee=new coffee();}

Please surround any code using the CODE tags - I rarely look at anything without them

#2 Yesideez

Yesideez
  • Members
  • PipPipPip
  • Advanced Member
  • 2,334 posts
  • LocationDevon, UK

Posted 19 August 2006 - 11:42 AM

I seem to have a case of "post a question then find the answer yourself"... :S

Change 666 to 0666 for octal and it works.

Only problem is, any picture I upload into profiles/oliveri/ gives me a 403 (Forbidden) when I try and display them.

Any idea of what permissions I have to set the "oliveri" folder to allow anyone access to it without letting the general public delete files contained within these folders?
Not a pro just an enthusiast :)

if (empty($coffee)) {$coffee=new coffee();}

Please surround any code using the CODE tags - I rarely look at anything without them

#3 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 19 August 2006 - 02:23 PM

Try 755 or 766.

#4 Yesideez

Yesideez
  • Members
  • PipPipPip
  • Advanced Member
  • 2,334 posts
  • LocationDevon, UK

Posted 19 August 2006 - 02:45 PM

Thanks, just been reading up on it and discovered that if a folder is set to "execute" it doesn't mean files in that folder can be executed (as I thought) but means that the folder can be searched/browsed.

Now just got to add a small index.html file in each folder to stop people browsing them...
Not a pro just an enthusiast :)

if (empty($coffee)) {$coffee=new coffee();}

Please surround any code using the CODE tags - I rarely look at anything without them

#5 sarman

sarman
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 19 August 2006 - 03:12 PM

good style also is put just one .htaccess with "deny from all" directive at the top of this tree of folders - and they never will be shown to user.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users