create folder in 777 problem

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
User avatar
potato
Forum Contributor
Posts: 192
Joined: Tue Mar 16, 2004 8:30 am
Location: my lovely trailer, next to the big tree

create folder in 777 problem

Post by potato »

The maps created wirh this code are sometimes 755 and sometimes 700 and so on. What am i doing wrong? why are they not 777 like i demand? :?

mkdir ("artists/$dirname" , 0777) or die;
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Can you CHMOD the folder?

It's possible that it's been disabled on the server.
dave420
Forum Contributor
Posts: 106
Joined: Tue Feb 17, 2004 8:03 am

Post by dave420 »

Or, simply that the user the webserver is running under doesn't have permission to change the mode of the folders itself, thereby rendering your code slightly limited...
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Changing/setting permissions on a folder will only set the permissions for that folder, not stuff inside. To do so, you need to set the 'sticky' bit. Try using '2777' instead of '0777'.

P.S. Are you sure you want to make the directory world writable?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply