Jump to content


Photo

Problem with mysqldump and PHP


  • Please log in to reply
No replies to this topic

#1 dzogchen

dzogchen
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 21 November 2003 - 12:54 PM

I have a rather large database that contains a few large tables and a large number of frequently changing very small tables i need to migrate to another server, and do it quickly so I minimize disrption of our site.

mysqldump doesn\'t seem to take wildcards, so i wanted to write a php script to automate the execution of mysqldump. I can generate the table names and then i put them into a string something like:

$dumpme = \"mysqldump --user=xxxx --password=xxxxx somedatabase $thistable > $thisdump n\";

and then use

$file = exec(\"$dumpme\");

if (!$file) {
echo \"Unable to dump file $thistable!<br> \";

}else{

echo \"dump of file $thisdump worked!<br>\";
}

if I take the string generated by echo $dumpme; and run it in a terminal window, it works.

If I run the php code, it fails.
i have also tried it with :
$file = exec($dumpme);
and it still fails. also shell_exec and passthru

Any ideas?

I thought of using php for generating a long shell script, and running that from the command line.

Any help appreciated




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users