Programmatically determine the maximum length of a file name

How to determine the maximum length of a file name in a linux field?

Preferred PHP programming language.

+3
source share
5 answers

You want pathconforfpathconf , which are not yet displayed (in PHP). (When they will, they are likely to be posix_pathconf.)

You can also use a command line interface with the same functionality. Try this on your system: getconf

$ getconf NAME_MAX /tmp

$ getconf PATH_MAX /tmp

+5
source

there is no need to define it programmatically. it's 255 bytes.

edit: (, reiser), 255, Linux.

+5

Linux - 255. , , , Linux. , . .

+3

, realpath(). , , :

< > $MaxLen = 264-STRLEN (Realpath ( 'index.php')));

264 - 255 ( lim) + 9 ('index.php' len). , .

0
source

You can use the constant PHP_MAXPATHLEN

0
source

Source: https://habr.com/ru/post/1713459/


All Articles