<?php
// FTP サーバーに接続する
$ftp = ftp_connect('ftp.example.com');
if (!$ftp) die('Unable to connect to ftp.example.com');
// "user" として、パスワード "pass" でログインする
if (!ftp_login($ftp, 'user', 'pass')) die('Error logging into ftp.example.com');
// FTP サーバーに "SITE CHMOD 0600 /home/user/privatefile" コマンドを発行する
if (ftp_site($ftp, 'CHMOD 0600 /home/user/privatefile')) {
echo "Command executed successfully.\n";
} else {
die('Command failed.');
}
?>