Oihana PHP

getOwnershipInfos.php

Table of Contents

Functions

getOwnershipInfos()  : OwnershipInfos
Retrieves the current ownership information of a given file or directory.

Functions

getOwnershipInfos()

Retrieves the current ownership information of a given file or directory.

getOwnershipInfos(string $path) : OwnershipInfos

Returns an OwnershipInfo object containing both numeric UID/GID and their corresponding human-readable owner and group names (if resolvable).

Requires the posix extension to resolve usernames and group names; otherwise, owner and group may be null.

Parameters
$path : string

Absolute or relative path to the file or directory.

Tags
throws
RuntimeException

If the given path does not exist.

example
use oihana\files\getOwnershipInfo;

$info = getOwnershipInfo('/var/www/html');

echo $info->owner; // 'www-data'
echo $info->uid;   // 33
echo $info;        // www-data:www-data (33:33)
Return values
OwnershipInfos

Object containing UID, GID, and optionally owner and group names.


        
On this page

Search results