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.

Unnecessary permissions can be stripped off using UNMASK command.

Unmask (777);

PHP – Explain how to work with Permissions in PHP – Jan 12, 2010 at 21:40 pm by Vidya Sagar

Explain how to work with Permissions in PHP.

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.

Posted in: PHP

Related FAQ's

Marius Ion ANGEL HOT SOFT LLC (800) 316-7677