[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 306
  • Last Modified:

PHP MkDir with set permissions

Hi all,

Is there anyway of creating a directory and setting it's permissions?

For example:

mkdir ('myDirectory','0777'); ?

THanks

0
error77
Asked:
error77
1 Solution
 
ncooCommented:
Yes you can do that.

However mode is ignored on Windows, setting 0777 will do nothing on Windows box.

http://uk.php.net/mkdir

The quotes around 0777 aren't strictly needed.

If this doesn't work you can always chmod, which will change the permission after the directory has been created.

mkdir ('myDirectory',0777);
chmod('myDirectory', 0777);
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now