PHP - Manual: posix_setrlimit
2024-11-13
(PHP 7, PHP 8)
posix_setrlimit — Set system resource limits
$resource
, int $soft_limit
, int $hard_limit
): boolposix_setrlimit() sets the soft and hard limits for a given system resource.
Each resource has an associated soft and hard limit. The soft limit is the value that the kernel enforces for the corresponding resource. The hard limit acts as a ceiling for the soft limit. An unprivileged process may only set its soft limit to a value from 0 to the hard limit, and irreversibly lower its hard limit.
resource
The resource limit constant corresponding to the limit that is being set.
soft_limit
The soft limit, in whatever unit the resource limit requires, or
POSIX_RLIMIT_INFINITY
.
hard_limit
The hard limit, in whatever unit the resource limit requires, or
POSIX_RLIMIT_INFINITY
.
成功时返回 true
, 或者在失败时返回 false
。
官方地址:https://www.php.net/manual/en/function.posix-setrlimit.php