What role does the user's root access play in the ability to delete files via FTP in PHP?

When using FTP in PHP to delete files, the user's root access determines their permissions to delete files. If the user does not have root access or sufficient permissions, they may encounter errors when trying to delete files via FTP. To solve this issue, the user should ensure they have the necessary permissions to delete files on the server.

// Connect to FTP server
$ftp_server = "ftp.example.com";
$ftp_user = "username";
$ftp_pass = "password";
$ftp_conn = ftp_connect($ftp_server);
$login = ftp_login($ftp_conn, $ftp_user, $ftp_pass);

// Delete file
$file_to_delete = "example.txt";
if (ftp_delete($ftp_conn, $file_to_delete)) {
    echo "File deleted successfully";
} else {
    echo "Error deleting file";
}

// Close FTP connection
ftp_close($ftp_conn);