View Full Version : chmod with php


Andybebad
03-27-2004, 04:12 AM
First of all chmod is how permissions are determined on Linux Servers. The way permissions are set is through numbers. An example of a chmod for a file would be 0777.
The numbers go in order by groups. The 2 number is for the group user. The third on for the group "group". The fourth for the group "world"( the most important one is world). You set each group's number to what ever you want them to be able to do. If you want user, group and world to be able to read, write and execute the file you would set it too 0777.
The 7 is for read, write and execute. Others are:
1:Execute only
2:Write only
3:Execute and write
4:read
5:Read and execute
6:Read and write
7:Read, write and execute

In this tutorial I will show you how to chmod files with a single php file. This can be usefull if you are developing a script and you want it to be easier to install. First of all here is the script:
CODE

<?php
$val = "/filename.txt";
@chmod("$val", 0777);
?>


In the 2 line we create a variable and it's data is the location of the filename from where the php file is located. In line 2 we tell it to chmod "/filename.txt" to 0777.
To use this script you just go to http://urdomain.com/chmod.php.
You can chmod any file on your server with this method to anything you want. You can also chmod more than one file at a time using this method.

Post questions below in the rules it says that there are no comments to be posted in this forum :) ~ mod