shantam Posted March 5, 2007 Share Posted March 5, 2007 Hello all and thanks for taking the time to consider this hair pulling problem of mine! So, I have some code (below) that works on one server (my local machine) and not on another (the server where it will live). For some reason, mysql is working fine, but mysqldump does not make a file when I call it form the php code. When I print the exact string that I am sending to the exec() command, and paste it into the command line, it works. Something is getting in the way... does anyone have any ideas? Here's the code which works on one server and not the other: ______________________ $username_database = "root"; $password_database = "blahblah"; $database_database = "my_database"; $backupFile = $_POST['name']; $command = "/Applications/MAMP/Library/bin/mysqldump -u $username_database --password=$password_database $database_database > Archives/Saved/$backupFile"; exec($command); ______________________ Thanks so much! -Shantam Quote Link to comment https://forums.phpfreaks.com/topic/41314-mysqldump-only-works-from-command-line-and-not-from-php/ Share on other sites More sharing options...
fenway Posted March 5, 2007 Share Posted March 5, 2007 Must be quoting issue or escaping issue. Quote Link to comment https://forums.phpfreaks.com/topic/41314-mysqldump-only-works-from-command-line-and-not-from-php/#findComment-200171 Share on other sites More sharing options...
shantam Posted March 5, 2007 Author Share Posted March 5, 2007 could you elaborate? Like I said... the code works on one server and not the other Quote Link to comment https://forums.phpfreaks.com/topic/41314-mysqldump-only-works-from-command-line-and-not-from-php/#findComment-200177 Share on other sites More sharing options...
fenway Posted March 5, 2007 Share Posted March 5, 2007 Then one of your server is misconfigured. Quote Link to comment https://forums.phpfreaks.com/topic/41314-mysqldump-only-works-from-command-line-and-not-from-php/#findComment-200184 Share on other sites More sharing options...
shantam Posted March 5, 2007 Author Share Posted March 5, 2007 can you think of how a server could be mis configured so that mysql works but mysqldump doesn't? I have looked at the permissions of the two and they are both the same... Quote Link to comment https://forums.phpfreaks.com/topic/41314-mysqldump-only-works-from-command-line-and-not-from-php/#findComment-200191 Share on other sites More sharing options...
artacus Posted March 5, 2007 Share Posted March 5, 2007 PHP may not have permissions to use exec(), your apache user may not have permissions to execute that file or to write the dump file. Quote Link to comment https://forums.phpfreaks.com/topic/41314-mysqldump-only-works-from-command-line-and-not-from-php/#findComment-200219 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.