CHMOD in PHP
Posted 30 March 2006 - 12:38 PM
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?
Posted 30 March 2006 - 01:22 PM
[a href=\"http://uk2.php.net/chmod\" target=\"_blank\"]http://uk2.php.net/chmod[/a]
I say old chap, that is rather amusing!
Posted 30 March 2006 - 01:40 PM
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
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users