• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 344
  • Last Modified:

PHP - Change folder CHMOD

Hi E's, Can you show a example how I change the CHMOD of a folder in php?

Regards, JC
0
Pedro Chagas
Asked:
Pedro Chagas
  • 2
2 Solutions
 
Ahmed MerghaniSoftware EngineerCommented:
Hi,

It is something like this:
<?php
// Read and write for owner, nothing for everybody else
chmod("test.txt",0600);

// Read and write for owner, read for everybody else
chmod("test.txt",0644);

// Everything for owner, read and execute for everybody else
chmod("test.txt",0755);

// Everything for owner, read for owner's group
chmod("test.txt",0740);
?> 

Open in new window


For more information see this links:
http://php.net/manual/en/function.chmod.php
http://stackoverflow.com/questions/5226457/php-chmod-usage
0
 
Pedro ChagasWebmasterAuthor Commented:
Hi, I know change CHMOD of a file, but what I need is change the mode of the folder!
0
 
Ahmed MerghaniSoftware EngineerCommented:
Ok. you can use it like this:

<?php
chmod("/path/",0755);
?>

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

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