Monday, May 13, 2013

how to work with Permissions in PHP 

Permissions in PHP are very similar to UNIX. Each file has three types of permissions – Read, write and execute. Permissions can be changed using the change mode or CHMOD command. CHMOD is followed by 3 digit number specifying the permission type. CHMOD 777 is for Read, Write and execute.


Permissions are set and unset with the following functions:

-mask(): To set the permissions to the files. Default value is 0777. The first digit is always 0, second digit indicates permission for the owner, third digit indicates the permission for owners group and the fourth digit indicates the permission for all users.
-umask(): To change the permissions to files – mask and 0777.

1 comment: