• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 340
  • 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 MerghaniCommented:
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 MerghaniCommented:
Ok. you can use it like this:

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

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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