How do I CHMOD a directory

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
andylyon87
Forum Contributor
Posts: 168
Joined: Sat Jan 31, 2004 5:31 am
Location: Dundee

How do I CHMOD a directory

Post by andylyon87 »

Hey guys just a quick one really,

How do I go about chmod'ing a directory on my server.

On creation of the folder by ftp_connect() it creates as 0755 and needs to be 0777

Please help

thanks
andy
andylyon87
Forum Contributor
Posts: 168
Joined: Sat Jan 31, 2004 5:31 am
Location: Dundee

Post by andylyon87 »

should I just be able to use,

Code: Select all

chmod($dir, 0777);
Thanks
Andy
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

short answer yes, providing $dir is the correct path to the directory or file.

you may have to look at http://www.php.net/manual/en/function.umask.php if it isn't working right and it's not a path issue.
andylyon87
Forum Contributor
Posts: 168
Joined: Sat Jan 31, 2004 5:31 am
Location: Dundee

Post by andylyon87 »

if

Code: Select all

$dir=/users/$username
because this wont work for me it keeps telling me I dont have the permissions to do that.

is there any way of doing it whilst I have the ft connecton open
Post Reply