Search code examples
phppermissionsmkdir

mkdir() full access and rights


i have a problem with the function mkdir()

i get that error message: Warning: mkdir() [function.mkdir]: Unable to access /user/$id

and do not understand why. i set the rights for this direction to 0777 on my server, means full access to create an direction for everyone. even in my php code is set it up to 0777. but it doesn#t work.

here is my code:

mkdir ( '/user/$id', 0777 );

that means it should create a subfolder into the directionsfolder named user. user is like i already said, 0777. the permission in php too. what am i doing wrong? thanks.


Solution

  • Do you have access to the root folder? You may not have access to add a directory /user.

    Try changing the single quotes to double quotes:

    mkdir ( "/user/$id", 0777 );
    

    This will allow you to pass the variable value into the string, instead of using $id.