Welcome Guest, Not a member yet? Register   Sign In
mkdir() problem: cannot create 0777 directory
#1

[eluser]Christophe28[/eluser]
Hi,

When users activate their account I create a dir for them to store all their uploaded files. However, with the mkdir() function of PHP it won't work. It create the dir properly, but set the permission to 0755 instead of 0777.

Code:
mkdir('/var/www/mywebsite.com/public/files/' . $user, 0777);
mkdir('/var/www/mywebsite.com/public/files/' . $user . '/thumbs', 0777);

By default, PHP should set the permission to 0777: http://be2.php.net/manual/en/function.mkdir.php

I already tried:
Code:
sudo chown myname:myname -R /var/www/mywebsite.com/public/files/

Code:
sudo chmod 777 -R /var/www/mywebsite.com/public/files/

Has this something to do with the config of the server?

Thx!

Christophe
#2

[eluser]clip[/eluser]
Not sure if your running on a windows server but windows ignores the mode.
#3

[eluser]Christophe28[/eluser]
No it's a Linux ubuntu karmic ...

I'd really appreciate if somebody could help me out here. Running out of options Sad

Thx!
#4

[eluser]Christophe28[/eluser]
I quickly fixed it by first creating the dirs and then chmod() to 777. But I don't really like this solution ...




Theme © iAndrew 2016 - Forum software by © MyBB