Please wait while we load your page...


PHP Manual :: ftp_site

ftp_set_option || ftp_size || FTP Functions || PHP Manual

(PHP 4, PHP 5, PHP 7)

ftp_siteSends a SITE command to the server


bool ftp_site ( resource $ftp_stream , string $command )

ftp_site() sends the given SITE command to the FTP server.

SITE commands are not standardized, and vary from server to server. They are useful for handling such things as file permissions and group membership.



The link identifier of the FTP connection.


The SITE command. Note that this parameter isn't escaped so there may be some issues with filenames containing spaces and other characters.

Return Values

Returns TRUE on success or FALSE on failure.


Example #1 Sending a SITE command to an ftp server

// Connect to FTP server
$conn ftp_connect('');
if (!
$conn) die('Unable to connect to');

// Login as "user" with password "pass"
if (!ftp_login($conn'user''pass')) die('Error logging into');

// Issue: "SITE CHMOD 0600 /home/user/privatefile" command to ftp server
if (ftp_site($conn'CHMOD 0600 /home/user/privatefile')) {
"Command executed successfully.\n";
} else {
'Command failed.');

See Also

  • ftp_raw() - Sends an arbitrary command to an FTP server

ftp_set_option || ftp_size || FTP Functions || PHP Manual
Live Chat Not Available