Jump to content

Archived

This topic is now archived and is closed to further replies.

gileze

CHMOD in PHP

Recommended Posts

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.

Share this post


Link to post
Share on other sites
this might help too:
[a href=\"http://uk2.php.net/chmod\" target=\"_blank\"]http://uk2.php.net/chmod[/a]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

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.