Re: PHP Automatic Backup
| From: | Richard Lynch | Date: | Sat, 06 Jul 2002 05:06:06 +0000 |
| Subject: | Re: PHP Automatic Backup | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-105824@lists.php.net to get a copy of this message | ||
>I was reading the post by Pag called MySQL backups and I have the same
>question, but not the shell access. It came to my mind, that if will be
>very useful for me, and probably for many of us newbies, to be able to
>build an automated PHP system that could make backups by itself at a
>specified time
lets say maybe every morning at 6 am, by transferring
>or uploading the MySQL files to another server. I noticed that this
>could be done in PHPNuke, by clicking at Backup Files. ¿Is it possible
>to build this kind of unattended scripts with PHP or will it always
>require a magical click from the administrator?
>
>I guess that it shouldnt be possible, but its worth a shot.
It *MIGHT* be possible for you to do:
<?php
exec("/full/path/to/mysqldump -u USERNAME --password=PASSWORD DBNAME",
$output, $error);
echo implode('', $output);
if ($error){
echo "OS Error: $error. Check 'man errno', but it's almost always
path/permissions.";
}
?>
If not, and if you have shell access on *another* machine, you could use
that machine to POST to the other machine a request to push the button.
Totally sucky way to do it, but you could.
It might be easier to just ask your ISP to create a cron job for you that
dumps the database to a file you can FTP regularly. It would take them
about 5 minutes to do this.
If all else fails: Just find another ISP that allows SSH access and switch
hosts :-)
--
Like Music? http://l-i-e.com/artists.htm