I'm trying to make a backup of the database from php.
This is the code I use:
$Copia_Archivo = $RutaDocumentos."/Copias/backup-" . date("d-m-Y") . ".sql.gz";
// comandos a ejecutar
$Comando = "mysqldump --host=".$_SESSION['Servidor']." --user=".$_SESSION['Usuario']." --password=".$_SESSION['Password']." ".$_SESSION['BaseDeDatos']." | gzip > $Copia_Archivo";
// ejecución y salida de éxito o errores
system($Comando,$output);
if ($output == 0) { $Salida = "Copia realizada correctamente"; }
if ($output == 1) { $Salida = "Archivo no encontrado"; }
if ($output == 2) { $Salida = "Archivo de copia corrupto"; }
echo $Salida;
But I created the file without any content.
The server is Debian and the php version that runs is 7.1.
What can I have wrong?