PHP lchgrp() Function

PHP lchgrp Function


Definition :
The PHP lchgrp() function attempts to change the group ownership of the specified symbolic link. Only the superuser may change the group ownership of a symlink arbitrarily. Other users may change the group ownership of a symlink to any group of which that user is a member.

Note: This function doesn't work on remote files as the file to be examined must be accessible via the server's filesystem.

Syntax

  lchgrp(filegroup)

Parameter
Parameter Description
file Required. Specifies the path to the symlink
group Required. Specifies the new group by name or number

Lets assume that we have a file called demo.txt in the current working directory. In the example below a symbolic link is created. Then, lchgrp() function is used to change its group ownership.

Output : 

Symbolic link has been created.
Group ownership is successfully changed