HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

posix_getrlimit

Description

The posix_getrlimit of POSIX for PHP returns information about system resource limits.

Syntax

posix_getrlimit(
    ?int $resource = null
): array|false

Parameters

resource

If null all resource limits will be fetched. Otherwise, the only limits of the resource type provided will be returned.

Return

Returns an associative array of elements for each soft and hard limit that is defined on success. Returns false on failure.

NameDescription
coreThe maximum size of the core file. When 0, not core files are created. When core files are larger than this size, they will be truncated at this size.
dataThe maximum size of the data segment for the process, in bytes.
stackThe maximum size of the process stack, in bytes.
totalmemThe maximum size of the memory of the process, in bytes.
rssThe maximum number of virtual pages resident in RAM
maxprocThe maximum number of processes that can be created for the real user ID of the calling process.
memlockThe maximum number of bytes of memory that may be locked into RAM.
cpuThe amount of time the process is allowed to use the CPU.
filesizeThe maximum size of the data segment for the process, in bytes.
openfilesOne more than the maximum number of open file descriptors.

Examples

1 · void

<?

$return = posix_getrlimit();

print_r($return);
Array
(
    [soft core] => 0
    [hard core] => unlimited
    [soft data] => unlimited
    [hard data] => unlimited
    [soft stack] => 8388608
    [hard stack] => unlimited
    [soft totalmem] => unlimited
    [hard totalmem] => unlimited
    [soft rss] => unlimited
    [hard rss] => unlimited
    [soft maxproc] => unlimited
    [hard maxproc] => unlimited
    [soft memlock] => unlimited
    [hard memlock] => unlimited
    [soft cpu] => unlimited
    [hard cpu] => unlimited
    [soft filesize] => unlimited
    [hard filesize] => unlimited
    [soft openfiles] => 1024
    [hard openfiles] => 1024
)

2 · resource · POSIX_RLIMIT_CORE

<?

$resource = POSIX_RLIMIT_CORE;

$return = posix_getrlimit($resource);

print_r($return);
Array
(
    [0] => 0
    [1] => unlimited
)

3 · resource · POSIX_RLIMIT_DATA

<?

$resource = POSIX_RLIMIT_DATA;

$return = posix_getrlimit($resource);

print_r($return);
Array
(
    [0] => unlimited
    [1] => unlimited
)

4 · resource · POSIX_RLIMIT_STACK

<?

$resource = POSIX_RLIMIT_STACK;

$return = posix_getrlimit($resource);

print_r($return);
Array
(
    [0] => 8388608
    [1] => unlimited
)

5 · resource · POSIX_RLIMIT_AS

<?

$resource = POSIX_RLIMIT_AS;

$return = posix_getrlimit($resource);

print_r($return);
Array
(
    [0] => unlimited
    [1] => unlimited
)

6 · resource · POSIX_RLIMIT_RSS

<?

$resource = POSIX_RLIMIT_RSS;

$return = posix_getrlimit($resource);

print_r($return);
Array
(
    [0] => unlimited
    [1] => unlimited
)

7 · resource · POSIX_RLIMIT_NPROC

<?

$resource = POSIX_RLIMIT_NPROC;

$return = posix_getrlimit($resource);

print_r($return);
Array
(
    [0] => unlimited
    [1] => unlimited
)

8 · resource · POSIX_RLIMIT_MEMLOCK

<?

$resource = POSIX_RLIMIT_MEMLOCK;

$return = posix_getrlimit($resource);

print_r($return);
Array
(
    [0] => unlimited
    [1] => unlimited
)

9 · resource · POSIX_RLIMIT_CPU

<?

$resource = POSIX_RLIMIT_CPU;

$return = posix_getrlimit($resource);

print_r($return);
Array
(
    [0] => unlimited
    [1] => unlimited
)

10 · resource · POSIX_RLIMIT_FSIZE

<?

$resource = POSIX_RLIMIT_FSIZE;

$return = posix_getrlimit($resource);

print_r($return);
Array
(
    [0] => unlimited
    [1] => unlimited
)

11 · resource · POSIX_RLIMIT_NOFILE

<?

$resource = POSIX_RLIMIT_NOFILE;

$return = posix_getrlimit($resource);

print_r($return);
Array
(
    [0] => 1024
    [1] => 1024
)