Ubuntu php mkdir

2.6k views Asked by At

I'm trying to create a directory but I get the wrong permissions everytime it creates the new directory.

Permissions on the file creating the folder:

rwxr-xr-x

Permission on the folder its trying to create it in

rwxr-xr-x

Both are owned by www-data www-data

I try to create the folder with php

mkdir(location,0775);

Result after running the script

r-----rwt

I ran out of reasons to believe it went wrong.

umask is on 002.

Hope somebody can help me.

Thanks in advance

1

There are 1 answers

5
Ian Wood On BEST ANSWER
$location = "path/to/you/dir";
$uold     = umask(0);

mkdir($location,0777,true);
umask($uold);

give that a try and see what it says...