Page 1 of 1

MySQL Backup Creating Empty File

Posted: Sat Sep 03, 2005 11:02 am
by illmapu
Hi,

I am trying to copy a backup of the database on the server, here is the code:

Code: Select all

$ste_backup = $db . date("Y-m-d-H-i-s") . '.sql';
$ste_backup2 = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $db > $ste_backup";
system($ste_backup2);
It is correctly naming the file by date, time and it ends in .sql etc, but the file is empty.

So, what happens is that it all looks perfect on the server, but no data in the file. I have set chmod to 777 too.

Any idea why the file would be empty or what I could do to fix it?

Thanks in advance! :)

Posted: Sat Sep 03, 2005 12:09 pm
by feyd
check your error logs, check the string to make sure all the variables are in there as you expect them.

Posted: Sat Sep 03, 2005 12:22 pm
by illmapu
Hi,

I have no error logs, all variables are as I expect, it is just creating an empty file, like it is not getting the data from doing the mysqldump.

Thanks

Posted: Sat Sep 03, 2005 12:26 pm
by feyd
have you tried using shell_exec() or exec() by chance?

Posted: Sat Sep 03, 2005 12:30 pm
by illmapu
Hi,

No I haven't.

The only problem is that the file has no data in it.

Thanks!

Posted: Sat Sep 03, 2005 12:38 pm
by feyd
well.. your syntax is wrong, it appears.

Code: Select all

$ste_backup = $db . date("Y-m-d-H-i-s") . '.sql';
$ste_backup2 = "mysqldump --opt -h$dbhost -u$dbuser -p$dbpass $db > $ste_backup";
system($ste_backup2);