Jump to content

execute mysqldump.exe on web server through PHP


obay

Recommended Posts

Hi! I use the following function to create a backup of my database and save it automatically to a file named "dump.sql".

 

function createDump($db_username,$db_password,$db_name) {

$pathToMysqlDump = "c:\xampplite\mysql\bin\mysqldump.exe";

$file = "dump.sql";
$query = "$pathToMysqlDump --allow-keywords --opt -u$db_username $db_password $db_name > $file";
shell_exec($query);

}

 

It uses the mysqldump.exe stored on my PC. The problem is it doesn't work when I upload it to the web server. What do I replace "c:\xampplite\mysql\bin\mysqldump.exe" with? and in what folder should I place a copy of mysqldump.exe on my web server? Can I put it on the same folder as the function above?

 

Any help appreciated.. thanks!

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.