Reputation: 6199
I am trying to create a folder on my server using php when i set it to 0777 it comes out as 755?
mkdir($create_path, 0777);
Thank you
Upvotes: 12
Views: 22532
Reputation: 111
This really works for me!, you should close now this question!
Give 777 permissions!
$estructure = '../files/folderName';
if(!mkdir($estructure, 0777, true)){
echo "<br/><br/>ERROR: Fail to create the folder...<br/><br/>";
} else echo "<br/><br/>!! Folder Created...<br/><br/>";
chmod($estructure, 0777);
Enjoy it!
Upvotes: 6
Reputation: 15070
Try this:
<?php
// files will create as -rw-------
umask(0);
// create a file, eg fopen()
chmod('/path/to/directory', 0777);
?>
Upvotes: 3
Reputation: 799390
The umask of the process is set to 0022. You'll need to set it to 0 if you want to create something with those two write bits set.
Upvotes: 0
Reputation: 10265
Try this:
$old_umask = umask(0);
mkdir($create_path, 0777);
umask($old_umask);
Upvotes: 29