php Function ssh2_sftp_chmod
Article about php function ssh2_sftp_chmod
The ssh2_sftp_chmod() functions allows you to get, set and query information from a SFTP file or directory. These functions are useful when you want to change the permissions of a remote file on the server. This is very important for when you are copying files between servers as this can cause problems if the file permissions do not match up. The chmod() functions allow you to change a file's permissions, atime() sets the file's access time and mtime() gets the modification time of a file.
ssh2_sftp_chmod() - Gets the permissions of a file or filepath in their octal representation. ssh2_sftp_chmod() also returns the permissions as an array for easier handling.
ssh_cmd - Sets the permissions of a file. ssh_cmd() can set user, group and file owner permissions. ssh_cmd can also change the mode of a file.
dirlist - Gets information for a file or directory. ssh_dirlist can return the number of files in a directory, the size of the directory, a list of filenames or an array of information about each file in the directory including its owner, mtime, atime, size and other properties.
is_dir - Checks whether a resource is a directory.
is_readable - Checks whether a file or directory is readable.
writable - Checks whether a file or a directory is writable.
ssh2_sftp_chmod() is an essential function when working with SFTP and should be used whenever possible to reduce the chances of errors. Use it in conjunction with other ssh2_sftp_* functions for the best results.