sonny Posted December 28, 2009 Share Posted December 28, 2009 Hi I am trying to backup a single complete database using a simple php script I currently use phpMyBackupPro it works fine but is a little to powerful for what I need. I have tried to implement the following but cannot get it to work, it appears to connect and it creates the backup .gz file but it contains nothing inside it. can someone please see what I am doing wrong. <?php $dbhost = 'testdb.hostedresource.com'; $dbname = 'testname'; $dbuser = 'testuser'; $dbpass = 'MyPassword'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname); $backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz'; $command = "mysqldump --opt -h $dbhost -u$dbuser -p$dbpass $dbname | gzip > $backupFile"; system($command); mysql_close($conn); ?> Thanks Sonny Quote Link to comment https://forums.phpfreaks.com/topic/186510-msql-backup-php-script-help/ Share on other sites More sharing options...
Mchl Posted December 28, 2009 Share Posted December 28, 2009 You might not have sufficent prvileges for running mysqldymp through system() See manual entry for details, and possible alternatives: http://php.net/manual/en/function.system.php Quote Link to comment https://forums.phpfreaks.com/topic/186510-msql-backup-php-script-help/#findComment-984953 Share on other sites More sharing options...
sonny Posted December 28, 2009 Author Share Posted December 28, 2009 Do you know another simple way to do this?, if so, can you show me? phpMyBackupPro works so I know it can be done Thanks Sonny Quote Link to comment https://forums.phpfreaks.com/topic/186510-msql-backup-php-script-help/#findComment-984965 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.