Hi, Try the same command in the command line prompt in your OS and see the output by opening the file. If you get empty file then you will confirm whether the problem is from mysql side or your programming side. Thanks & Regards Udayakumar Sarangapani Sr. PHP Developer CompIndia Infotech Pvt. Ltd. Chennai. "Science is nothing but logic..." ----- Original Message ---- From: Larry Helms <larr_helms@xxxxxxxxx> To: php-objects@xxxxxxxxxxxxxxx Sent: Friday, 11 July, 2008 2:45:15 AM Subject: Re: Getting empty .sql file when we run backup code please see the code First, let me say... that I'm using MAMP on a Mac... so the location of mysqldump is most likely different than what you're using... but when I reduced your code down to just executable lines... and only those necessary to DO the backup I came up with the following below (with a few enhancements) . On the mysqldump command I should note... that you had THREE '-', rather than two. e.g. you had: ---user where you should have had --user You also were NOT sending the file anywhere. You need to add '> '.$backupFile; Also, use the 'echo $command' line... to output your command... and then cut-n-paste it to the command line to insure that it functions properly. <?php $dbname = 'dbname' ; $dbuser = 'user'; $dbpass = 'password'; $dbhost = 'localhost'; ; $datetime = date ('Ymd_His'); $backupFile = '/tmp/'.$datetime. '-'.$dbname. '.sql'; $mysqldump = '/Applications/ MAMP/Library/ bin/mysqldump' ; $command = $mysqldump." --user ".$dbuser." --password=" .$dbpass. " ".$dbname." > ".$backupFile; echo "command = ".$command." \n"; exec ($command, $retval); var_dump ($reval); ?> From Chandigarh to Chennai - find friends all over India. Go to http://in.promos.yahoo.com/groups/citygroups/ [Non-text portions of this message have been removed]