Hi thanks for the code but unfortunatly still it doesn't work.. i don't know why.. this time i can see the console opening and the dump on scrolling inside it but the file is still empty..
I modified the code a bit to make it works on my system, yours didn't (don't know why)
Now, everytime i run the backup files, windows opens a requester asking me for permission (in my system there an admin and a user).. I also tried to modified the property of the mysqldump.exe giving it the permission (run as administrator)..
Here my code:
PHP Code <?php
$host="localhost";
$user="root";
$password="root";
$db="trasporti";
$file='C:/Program Files/Ampps/www/t6/backup/';
$file.="dump.sql";
$db_connect=mysql_connect("$host", "$user", "$password");
mysql_select_db("$db");
$mydump = '"C:/Program Files/Ampps/mysql/bin/mysqldump.exe"';
$command = $mydump.' -h '.$host.' -u '.$user.' -p"'.$password.'" '.$db.' > "'.$file.'"';
$temp = 'C:/Program Files/Ampps/temp/t'.rand(1, 999).'.bat';
$fp = fopen ($temp, "w+");
fwrite($fp, $command);
fclose($fp);
@exec('"'.$temp.'"', $array, $ret);
unlink($temp);
mysql_close($db_connect);
?>
I suspect there is something wrong in my apache/mysql setup or something that i am missing.. and also i think that the comand (mysqldump.exe) should be inserted into my shell path.. Do you know how to do this?
Thanks Davide,
|