PHP ftp_chmod() Function

PHP ftp_chmod() Function


Define :

In this tutorial we learned about PHP ftp_chdir() Function.This PHP ftp_chdir() Function is inbuilt function in php.This function is used to sets the permissions on the specified remote file to permissions. The function returns the new file permissions on success or false on error.

Syntax
ftp_chmod(ftp, permissions, filename)
Parameters
ftp Required. Specify the FTP connection to use.
permissions Required. Specify the new permissions, given as an octal value (starting with 0). The parameter consists of four numbers:
  • The first number is always zero (octal value)
  • The second number specifies permissions for the OWNER
  • The third number specifies permissions for the OWNER's USER GROUP
  • The fourth number specifies permissions for EVERYBODY ELSE
Possible values (to set multiple permissions, add up the following numbers):
  • 1 = execute permissions
  • 2 = write permissions
  • 4 = read permissions
filename Required. Specify the file to set permissions on.

Given below example show the usage of  ftp_chmod() function.

 

Note: Many FTP servers do not support this command!

Output : Successfully connected to www.webdesigninghouse.com! Couldn't connect as user Connection closed successfully!