Guys, I hope you can help me, im having truoble executing mysqldump via php script. Im not sure what user right i should have. Sample Code: $mysql_username="xxx"; $mysql_password="yyy"; $mysql_database="zzz"; $path=$_SERVER['DOCUMENT_ROOT']; $backupFile=$path.'/test.sql'; $command = "mysqldump -u{$mysql_username} -p{$mysql_password} {$mysql_database} > $backupFile"; system($command); exit(); Thanks in advance Mike
What is the error message? And can you try changing the path to a directory that is write-enabled for all? And why do you use "system" not shell_exec?
Hi, Thanks for the help. Actually the directory is writable coz i can fopen a file there and it appends. No error message when i use system() I try shell_exec but an error occur Warning: shell_exec(): Cannot execute using backquotes in Safe Mode . This line was $command = "mysqldump -u{$mysql_username} -p{$mysql_password} {$mysql_database} > $backupFile"; shell_exec($command); Thanks, Mike
I've used exec to do shell-commands. Don't know what the difference in exec and shell_exec is, though.