I have tried to backup my MySQL databases using PHP, yet when I set the path for the backup I receive another path when running the script.
this is my script:
$baseDir = 'backup/';
$db;
$table;
$server = $_SERVER['HTTP_HOST'] . substr($_SERVER['SCRIPT_NAME'],0,strrpos($_SERVER['SCRIPT_NAME'],'/'));
this is inside the backup function:
global $baseDir;
global $db;
global $server;
$backupFile = $server . "/$baseDir$db/$tab.sql";
$query = mysql_query("SELECT * INTO OUTFILE '$backupFile' FROM $tab");
if(!$query)
    echo "\t" .mysql_error() .PHP_EOL;
else
    echo " backuped." . PHP_EOL;
the path I get is: c:\wamp\bin\mysql\mysql5.1.36\data\localhost\db\backup\contact_keeper\accounts.sql with erroCode: 2 (can`t write/create).
mysqldump- dev.mysql.com/doc/refman/5.1/en/mysqldump.html