A word of caution, execution via FTP isn't very widely supported.  Check that it works on the servers that you intend to connect to before you start coding something that requires this.(PHP 4 >= 4.0.3, PHP 5, PHP 7, PHP 8)
ftp_exec — Fordert die Ausführung eines Programmes auf dem FTP-Server an
   Sendet ein SITE EXEC-Kommando (command) an den
   FTP-Server.
  
   Gibt true zurück, wenn das Kommando erfolgreich war (d. h. der Server hat
   den Antwortcode 200 gesendet), sonst false.
  
| Version | Beschreibung | 
|---|---|
| 8.1.0 | Der Parameter ftperwartet nun eine
  FTP\Connection-Instanz; vorher wurde eine Ressource
  erwartet. | 
Beispiel #1 ftp_exec()-Beispiel
<?php
// Variable initialisieren
$command = 'ls -al >files.txt';
// Verbindung aufbauen
$ftp = ftp_connect($ftp_server);
// Login mit Benutzername und Passwort
$login_result = ftp_login($ftp, $ftp_user_name, $ftp_user_pass);
// Kommando ausführen
if (ftp_exec($ftp, $command)) {
    echo "$command wurde erfolgreich ausgeführt\n";
} else {
    echo "$command konnte nicht ausgeführt werden\n";
}
// Verbindung schließen
ftp_close($ftp);
?>A word of caution, execution via FTP isn't very widely supported.  Check that it works on the servers that you intend to connect to before you start coding something that requires this.