Jump to content

Database Back Up Using Php Script


deepshah

Recommended Posts

Hello everyone - I want to take backup of my database using cron. I found following php script with the help of google.<?php/*Quickly and easily backup your MySQL database and have the tgz emailed to you. You need PEAR installed with the Mail and Mail_Mime packages installed. Read more about PEAR here: http://pear.php.net. This will work in any *nix enviornment. Make sure you have write access to your /tmp directory.*/// mysql & minor details..$tmpDir = "/tmp/";$user = "root";$password = "pass";$dbName = "db";$prefix = "db_";$sqlFile = $tmpDir.$prefix.date('Y_m_d').".sql";$creatBackup = "mysqldump -u ".$user." --password=".$password." ".$dbName." > ".$sqlFile;exec($creatBackup);?>I have made try with this script, but still i don't get the desired result. So, can anyone help me for the above issue..?Thanks in advance...@:-Deep

Link to comment
Share on other sites

What debugging steps have you taken? Is error reporting on? Echo some stuff at various stages to see where the scritp contains bad data, like echo the query before the call to exec(). Do you have permissions for the tmp dir = 0777?Is the exec() enabled?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...