Jump to content

mysqldump only works from command line and not from php


shantam

Recommended Posts

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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.