Jump to content


Photo

CHMOD in PHP


  • Please log in to reply
4 replies to this topic

#1 gileze

gileze
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 30 March 2006 - 12:38 PM

Hi There.

I am creating a script for automatic folder creation with full access priveliges.

I know the decimal value for CHMOD is 777 but that doesnt work in PHP.

Does anyone know the Octal value for 777?

Thanks.

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 30 March 2006 - 12:53 PM

0777

#3 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 30 March 2006 - 01:22 PM

this might help too:
[a href=\"http://uk2.php.net/chmod\" target=\"_blank\"]http://uk2.php.net/chmod[/a]

"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!

#4 craygo

craygo
  • Staff Alumni
  • Advanced Member
  • 1,973 posts
  • LocationRhode Island

Posted 30 March 2006 - 01:40 PM

Here is a breakdown of chmod. Even though php usesthe 4 digit code, ie 0755 only the last tree really mean anything.

I will use and example of 0764 as a chmod

0 = Sort of a buffer for php leave it at 0
7 = Owners Rights //Owners position
6 = Group Rights //Group position
4 = Everyone elses writes //Everyone position

The digit can be any of the defined value (explained in a second) the position is important.

Now the numbers are derived like so

1 = Execute
2 = Write
4 = Read

So what you do is add up the permissions you want to give and use that number in the position you want.

Example above 764 mean

Owner has full access Read, Write, Execute 4+2+1=7
Group has Read, Write 4+2=6
Everyone has Read 4

Hope that helps

Ray

#5 gileze

gileze
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 30 March 2006 - 02:06 PM

Ok thanks, all works now.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users