glenelkins Posted September 30, 2009 Share Posted September 30, 2009 Hi Any idea why the following code is just producing an empty file? // Vars $_tmpDir = __SITE_PATH . '/Backups/'; $_prefix = "db_"; $_user = "root"; $_password= "74hfnf3"; $_database = "shoppingcart"; $_sqlFile = $_tmpDir . $_prefix . date ( "Y-m-d-H-i-s", time() ) . '.sql'; $attachment = $_tmpDir . $_prefix . date ( "Y-m-d-H-i-s", time() ) . '.tgz'; $_createBackup = 'mysqldump -u ' . $_user . ' --password=' . $_password . ' ' . $_database . ' > ' . $_sqlFile; $_createZip = "tar cvzf $attachment $_sqlFile"; exec ( $_createBackup ); exec ( $_createZip ); unlink ( $_sqlFile ); Link to comment https://forums.phpfreaks.com/topic/176036-mysql-dump/ Share on other sites More sharing options...
mvfreelance Posted September 30, 2009 Share Posted September 30, 2009 has your code ever worked? If, yes then some change to your enviromment might have caused the script to stop working. eg. someone might 've changed the root password. Or the permitions to the storage directory If your code has just being done and it doesn't work, then try: $_createBackup = 'mysqldump -u' . $_user . ' -p' . $_password . ' ' . $_database . ' -R --opt -q --single-transaction > ' . $_sqlFile; check dev.mysql.com/doc/refman/5.1/en/mysqldump.html for the manual Also, Link to comment https://forums.phpfreaks.com/topic/176036-mysql-dump/#findComment-927607 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.