peranha Posted March 18, 2008 Share Posted March 18, 2008 <?php require ("../connect.php"); // open connection $connection = mysql_connect($server, $user, $pass) or die ("Unable to connect!"); $backupFile = "../" . $db . date("Y-m-d-H-i-s") . '.sql'; $command = "mysqldump --all-$db > $backupFile"; system($command); // close connection mysql_close($connection); header("Location: admin.php"); ?> I get "'mysqldump' is not recognized as an internal or external command, operable program or batch file." in my error log when I try to run this in the web browser. Any body have any ideas? Link to comment https://forums.phpfreaks.com/topic/96639-mysqldump-is-not-recognized/ Share on other sites More sharing options...
eddierosenthal Posted March 18, 2008 Share Posted March 18, 2008 if this is a unix box and you can run the command at the shell prompt then you have the path probably in your .login or .exrc file or something. if its a windows box you probably don't have the path. try tweaking the mysqldump to have full path. Link to comment https://forums.phpfreaks.com/topic/96639-mysqldump-is-not-recognized/#findComment-494544 Share on other sites More sharing options...
Gamic Posted March 18, 2008 Share Posted March 18, 2008 You have not given mysqldump your username and password. Here is the man page entry for it mysqldump. <?php //require ("../connect.php");//mysqldump will create its own connection to the database // open connection //$connection = mysql_connect($server, $user, $pass) or die ("Unable to connect!"); $backupFile = "../" . $db . date("Y-m-d-H-i-s") . '.sql'; $username="someName"; $password="password"; $command = "mysqldump --all-$db -u $username -p $password > $backupFile"; system($command); // close connection //mysql_close($connection); header("Location: admin.php"); ?> Link to comment https://forums.phpfreaks.com/topic/96639-mysqldump-is-not-recognized/#findComment-494577 Share on other sites More sharing options...
trq Posted March 18, 2008 Share Posted March 18, 2008 You likely need to give the full path to mysqldump. eg; $command = "/usr/bin/mysqldump --all-$db -u$username -p$password > $backupFile"; Link to comment https://forums.phpfreaks.com/topic/96639-mysqldump-is-not-recognized/#findComment-494662 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.