4images Forum & Community
4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: dbranko on February 06, 2007, 01:49:23 PM
-
When i try to make database backup,on finish backup,his size is 3,9MB and it is corupted! Hi is 8,2MB realy!Whats wrong!Sorry,bad english! :cry:
-
<?php
$host = "XXXXXXXX";
$db = "XXXXXXXX";
$dbuser = "XXXXXXXX";
$dbpw = "XXXXXXXX";
MYSQL_CONNECT($host, $dbuser, $dbpw) or die ( "<H3>Datenbankserver nicht erreichbar</H3>");
MYSQL_SELECT_DB($db) or die ( "<H3>Datenbank nicht vorhanden</H3>");
$path = getenv('DOCUMENT_ROOT')."/DB_backup";
$result = MYSQL_QUERY("SHOW TABLES");
$numrow = MYSQL_NUM_ROWS($result);
for($i = 0;$i < $numrow;$i++) {
$date = date("D");
$table = MYSQL_RESULT($result,$i);
echo "$date.$table ... ";
system(sprintf("mysqldump --opt -h $host -u $dbuser -p$dbpw $db $table | gzip > %s/$date.$table.sql.gz",$path));
echo "DONE <br><br>";
}
MYSQL_CLOSE();
?>
You can use this PHP Script to make a Backup from the DB with a Cronjob... (o:
Try this...
-
I dont understand what to do with that code?
-
Copy the Script into the root folder creat a folder "DB_backup" (chmod 777)...
Then call www.yourdomain.tdl/backup.php and after that take a look into the DB_backup folder... (o:
-
What is the name of that script?
-
xxxxxxxx.php or my_backup.php or what_else.php... (o: