PHP chgrp Function: Change File Group Ownership
The article explains PHP’s chgrp function, which changes a file’s group ownership, outlines its syntax, required parameters, permission restrictions, return values, and provides a complete PHP example demonstrating how to modify a file’s group and display the result.
chgrp changes the group ownership of a file. It attempts to set the group of $filename to $group (specified by name or numeric ID). Only the superuser can change any file’s group; other users may only set the group to one they belong to.
Signature: bool chgrp(string $filename, mixed $group)
Parameters:
filename : Path to the file.
group : Group name or numeric ID.
Return value: Returns TRUE on success, or FALSE on failure.
Example:
Laravel Tech Community
Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.