PHP - change file permissions

changes the owner of the file

chown('/path/to/file', 'user_name');

changes the usergroup of the file

chgrp('/path/to/file', 'user_name');

changes the permissions of the file

chmod('/path/to/file', 0777);