Home >Backend Development >PHP Tutorial >PHP related system functions_PHP tutorial
get_current_user () Gets the name of the owner of the current PHP script
substr(sprintf("%o",fileperms(getcwd())),-4) Get the current file/directory permissions
scandir(getcwd()) Gets all files/directories in the current directory
print_r(posix_getpwuid(10000)); Get user information of a certain uid
chmod("test.txt",0777); Modify the permissions of the specified file or directory
The fileowner() function returns the owner of the file.
php_uname() Get system type and version
getmyuid() Get the UID number of the owner of the PHP script page
print_r (ini_get_all()); Get all configuration options
print_r (php_ini_scanned_files()); Returns the configuration file list in the configuration file directory
$uid = @posix_getpwuid(@posix_geteuid()); Get the current UID information
$gid = @posix_getgrgid(@posix_getegid()); Get the current group GID information
$user = $uid['name']; Extract name
from the user information array
$uid = $uid['uid']; Extract uid
from the current user information array
$group = $gid['name']; Extract name
from the current group information array
$gid = $gid['gid']; Extract gid
Excerpted from: lostwolf's Blog