#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    9
    Rep Power
    0
    Hi,
    I am having problems with the following script:
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    <?
    $db_user = "extremeforums";
    $db_password = "password";
    $db_host = "localhost";
    $db_name = "extremeforums";
    $backup_dir = "/www/extremeforums/backup";
    $date = date("Y_m_d");

    $command = `mysqldump -u$db_user -p$db_password $db_name | gzip > $backup_dir/$db_name$date.gz`;

    if (exec($command) == 0) {
    echo "Backup Successfull!";
    }else {
    echo "Backup Failed!";
    }

    ?>
    [/code]

    It will successfully create the archive but it doesnt contain anything. Its total size is like 20 kb.

    The funny this is the command will work from telnet but when fed thru this script it just chokes.

    Any help would be much appreciated!

    Chris Miller http://www.extremeforums.com


    ------------------
    "Reality is for people who lack imagination"
  2. #2
  3. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    62
    1. Have you debugged your query? As in:

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    <?$db_user = "extremeforums";
    $db_password = "password";
    $db_host = "localhost";
    $db_name = "extremeforums";
    $backup_dir = "/www/extremeforums/backup";
    $date = date("Y_m_d");
    $command = `mysqldump -u$db_user -p$db_password $db_name | gzip > $backup_dir/$db_name$date.gz`;
    // if (exec($command) == 0) { echo "Backup Successfull!";
    // }else { echo "Backup Failed!";
    // }
    echo $command;

    ?>[/code]

    2. I don't see you using your hostname ($db_host) in your command.

    3. Have you tried putting full quotes (") around your query string.

    I would write the query as:

    $command = "mysqldump -u $db_user -p$db_password $db_name | gzip > $backup_dir/$db_name$date.gz"; //notice the space between -u and $db_user

    4. Are you sure you are using the right user, with full rights to the database?

    5. And finally, have you tried it without gzipping it?

    [This message has been edited by rycamor (edited August 05, 2000).]

Similar Threads

  1. script to backup mysqldatabase
    By csross in forum Scripts
    Replies: 5
    Last Post: July 28th, 2004, 06:47 PM
  2. problem with login script
    By jalbertson in forum PHP Development
    Replies: 8
    Last Post: February 19th, 2004, 03:43 PM
  3. ksh script sqlplus < file.sql problem
    By yarona in forum UNIX Help
    Replies: 1
    Last Post: February 17th, 2004, 07:39 AM
  4. DreamWeaver MX and MySQL problem!!
    By genog in forum MySQL Help
    Replies: 3
    Last Post: February 12th, 2004, 06:57 AM
  5. Mysql backup
    By kajic in forum PHP Development
    Replies: 4
    Last Post: February 11th, 2004, 04:48 PM

IMN logo majestic logo threadwatch logo seochat tools logo