Call Us : +91-8376986802 (Viber, WhatsApp)

Explain the changing file permission and ownership using PHP’s chmod() function.



Chmod() is used for changing permissions on a file.

Syntax:

Chmod(file, mode)

Mode here specifies the permissions as follows:

The first number is always zero
The second number specifies permissions for the owner
The third number specifies permissions for the owner’s user group
The fourth number specifies permissions for everybody else
Possible values (to set multiple permissions, add up the following numbers)

1 = execute permissions
2 = write permissions
4 = read permissions
Example:
// everything for owner, read for owner’s group
chmod(“test.txt”,0740);

Leave a Reply