|
Posted by vesakilp on 09/10/06 13:48
> In theory this should work, but change your shell_exec($backup); to
>
>
> $error_message=shell_exec($backup);
> echo "Command used: ".$backup."<br>\nOutput from command:
> ".$error_message."<br>\n";
>
> in your script, and then you see how your command line looks like and what the
> command does output. By the way, as you are using the mysqldump command, you
> don't need to connect to the database in the php script.
>
> At least in the mysql command you don't have spaces between -u and the
> password, the same for -p too and most likely for the -h too.
>
> $backup = "mysqldump -hlocalhost -u$duser -p$dpass $dbase table_name >
> backup/table_name.sql";
>
>
> //Aho
Well I did as told, and this was result:
Code:
<?php
include "settings.inc";
global $dbase;
global $duser;
global $dpass;
$backup = "mysqldump -hlocalhost -u$duser -p$dpass $dbase table >
backup/table.sql";
$error_message = shell_exec($backup);
echo "Command used: ".$backup."<br>\nOutput from command:
".$error_message."<br>\n";
?>
Error message:
Command used: mysqldump -hlocalhost -u<username> -p<password>
<database> <table> > backup/table.sql
Output from command:
So there wasn't any out put from $error_message. File was still
created, but it was empty. Starting to piss me off.
By the way, same mysqldump script works fine when executed in console.
[Back to original message]
|