PHP ftp_site() Function
Example
Send an FTP SITE command:
<?php
// connect and login to FTP server
 $ftp_server = "ftp.example.com";
$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);
// try to send SITE command
 if (ftp_site($ftp_conn, "chmod 777 serverfile.txt"))
  {
  echo "Command executed successfully";
  }
else
  {
  echo "Command failed";
  }
 
// close connection
ftp_close($ftp_conn);
?>
Definition and Usage
The ftp_site() function sends a SITE command to the FTP server.
Note: SITE commands vary from server to server. They are useful for handling OS specific features such as file permissions and group membership.
Tip: To see what SITE commands are available, send the REMOTEHELP command using the ftp_raw() function.
Syntax
ftp_site(ftp_conn, command);
Parameter Values
| Parameter | Description | 
|---|---|
| ftp_conn | Required. Specifies the FTP connection to use | 
| command | Required. Specifies the SITE command (this parameter is not escaped) | 
Technical Details
| Return Value: | TRUE on success, FALSE on failure | 
|---|---|
| PHP Version: | 4+ | 
❮ PHP FTP Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.