<?php $host = "localhost"; $user = "root"; $pass = ""; // On définit les infos de la base de données $db = "mabase"; $date = date("d-m-Y"); // On définit le variable $date ( ici son format )
$backup = $db."bdd-backup_".$date.".sql.gz"; // Utilise les fonctions système : MySQLdump & GZIP pour générer un backup gzipé $command = "mysqldump -h$host -u$user -p$pass $db | gzip> $backup"; system($command); // Démarre la procédure de téléchargement $taille = filesize($backup); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: application/gzip"); header("Content-Disposition: attachment; filename=$backup;"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".$taille);
@readfile($backup); // Supprime le fichier temporaire du serveur unlink($backup); ?>
Le server (sous windows WAMP) me renvoie cette erreur :
Warning: filesize() [function.filesize]: stat failed for upload/freebdd-backup_12-10-2006.sql.gz in D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php on line 13
Warning: Cannot modify header information - headers already sent by (output started at D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php:13) in D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php on line 14
Warning: Cannot modify header information - headers already sent by (output started at D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php:13) in D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php on line 15
Warning: Cannot modify header information - headers already sent by (output started at D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php:13) in D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php on line 16
Warning: Cannot modify header information - headers already sent by (output started at D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php:13) in D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php on line 17
Warning: Cannot modify header information - headers already sent by (output started at D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php:13) in D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php on line 18
Warning: Cannot modify header information - headers already sent by (output started at D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php:13) in D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php on line 19
Warning: Cannot modify header information - headers already sent by (output started at D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php:13) in D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php on line 20
Warning: Cannot modify header information - headers already sent by (output started at D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php:13) in D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php on line 21
Warning: Cannot modify header information - headers already sent by (output started at D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php:13) in D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php on line 22
Warning: unlink(upload/freebdd-backup_12-10-2006.sql.gz) [function.unlink]: No such file or directory in D:\Documents and Settings\Seb\Mes documents\Site web\Localhost\ztest.php on line 25
Je ne voie vraiment pas d'où cela peut venir ! Si quelqu'un a une idée ?
Merci d'avance
Séb
la pluspart des erreur viennent des headeur est ce que tu as du code (html) avant l'ouverture de la balise PHP (enleve meme les espace au cas ou)
Ma page est composée uniquement du script ! Pour faire des tests, je procède toujours ainsi, il faut que je rajoute <html><head></head><body></body></html> en dessous ?
Je ne trouve vraiment pas la solution, est-ce que quelqu'un a trouvé qqch ?
<< On n'apprend bien qu'à force de se tromper. >>
Problème sur un tutorial
× Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
× Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
<< On n'apprend bien qu'à force de se tromper. >>
<< On n'apprend bien qu'à force de se tromper. >>
<< On n'apprend bien qu'à force de se tromper. >>