You are here: Re: mysql dump creates empty file « PHP SQL « IT news, forums, messages
Re: mysql dump creates empty file

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация