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

posix_fpathconf

PHP function Edit on GitHub ✎

(PHP 8 >= 8.3.0)

Returns the value of a configurable limit

Description

posix_fpathconf(resource|int $file_descriptor, int $name): int|false

Returns the value of a configurable limit from name for file_descriptor.

Parameters

name

The name of the configurable limit, one of the following. POSIX_PC_LINK_MAX, POSIX_PC_MAX_CANON, POSIX_PC_MAX_INPUT, POSIX_PC_NAME_MAX, POSIX_PC_PATH_MAX, POSIX_PC_PIPE_BUF, POSIX_PC_CHOWN_RESTRICTED, POSIX_PC_NO_TRUNC, POSIX_PC_ALLOC_SIZE_MIN, POSIX_PC_SYMLINK_MAX.

Return Values

Returns the configurable limit or false.

Errors/Exceptions

Throws a ValueError when resource is invalid.

Changelog

VersionDescription
8.5.0Now sets last_error to EBADF and raises an E_WARNING when an invalid file descriptor is encountered.

Examples

posix_fpathconf() example

This example will get the max path name's length in bytes for the current dir.

php
<?php
$fd = fopen(__DIR__, "r");
echo posix_fpathconf($fd, POSIX_PC_PATH_MAX);
?>

The above example will output:

output
4096

See Also

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