Permission Issues

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Bigun
Forum Contributor
Posts: 237
Joined: Tue Jun 13, 2006 10:50 am

Permission Issues

Post by Bigun »

Ok, I create a directory and it looks like this:

Code: Select all

dr----x--t  2 nobody   nobody   4096 Jun 22 13:42 b-6/
And I need full access in order for my users to post stuff.

Here's the code I'm using:

Code: Select all

mkdir ("./users/pics/".$uid);
chmod("./users/pics/".$uid, 777);
What can I do?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

0777 for starters. ;)
Bigun
Forum Contributor
Posts: 237
Joined: Tue Jun 13, 2006 10:50 am

Post by Bigun »

I never understood what that extra 0 does. A simple "chmod 777 *filename*" works in Linux just fine.

I always thought octal binary only had 3 binary digits.

(It worked BTW)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

A leading zero in C based languages is the marker for octal numbers and 0x for hexidecimal. Standard integers and decimals get nothing special.
bdlang
Forum Contributor
Posts: 395
Joined: Tue May 16, 2006 8:46 pm
Location: Ventura, CA US

Post by bdlang »

Bigun wrote:I never understood what that extra 0 does. A simple "chmod 777 *filename*" works in Linux just fine.
This is true; however, the initial bit is a switch. '4' is the setuid bit, '2' is the setgid bit, '1' makes the file 'sticky' and '0' clears all. Unless you do alot of linux sysadmin, you may not have a use for any of these.

linuxbox> $ man chmod
Post Reply