Chmod () and chown () of a symlink file in PHP

Are there PHP commands for changing the permissions / owner of a symbolic link file, and not for objects referenced by a symbolic link?

From the shell I can

$ mkdir adir
$ ln -s adir alink
$ chmod 0700 alink         -- changes permissions of directory adir
$ chmod -h 0700 alink      -- changes permissions of file alink

but I don’t see how to make the last of them in PHP, except to call the shell, for example. a exec().

+3
source share
1 answer

PHP does not support changing the permissions of symbolic links (no function lchmodsuch as lstatand lchown).

Linux does not support it :

POSIX lchmod, Linux . , lchmod, symlinks , , , (0777), .

BSD, lchmod, 0555 (readlink() , ENOENT , / ), , , symperm.

+3

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


All Articles