php8.5
Home/ Manual/ posix / functions/ posix_setegid

posix_setegid

PHP function Edit on GitHub ✎

(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)

Set the effective GID of the current process

Description

posix_setegid(int $group_id): bool

Set the effective group ID of the current process. This is a privileged function and needs appropriate privileges (usually root) on the system to be able to perform this function.

Parameters

group_id

The group id.

Return Values

Success

Examples

posix_setegid() example

This example will print out the effective group id, once changed.

php
<?php
echo 'My real group id is '.posix_getgid(); //20
posix_setegid(40);
echo 'My real group id is '.posix_getgid(); //20
echo 'My effective group id is '.posix_getegid(); //40
?>

See Also

Source: reference/posix/functions/posix-setegid.xml · from the official PHP manual (php/doc-en)