|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
This is how I do a backup of a mysql database with php:
$backupFile = '/home/owner/dbbackup/'.$dbname .'-' .$filename. '.sql'; $command = "mysqldump --opt -h $dbhost -u $dbuser -p$dbpass $dbname> $backupFile"; $dummy = system($command, $retval); It works OK and creates a .sql file, but how do I compress the file to a gzip file? Kind regards, Jan Nordgreen |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Thu, 24 Apr 2008 19:09:13 -0700 (PDT), damezumari wrote:
> This is how I do a backup of a mysql database with php: > > $backupFile = '/home/owner/dbbackup/'.$dbname .'-' .$filename. > '.sql'; > $command = "mysqldump --opt -h $dbhost -u $dbuser -p$dbpass $dbname> > $backupFile"; > $dummy = system($command, $retval); > > It works OK and creates a .sql file, but how do I compress the file to > a gzip file? $command = "gzip $backupFile"; $dummy = system($command, $retval); maybe? I can't imagine that you haven't thought of this, so there must be *something* wrong with it. -- 31. All naive, busty tavern wenches in my realm will be replaced with surly, world-weary waitresses who will provide no unexpected reinforcement and/or romantic subplot for the hero or his sidekick. --Peter Anspach's list of things to do as an Evil Overlord |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
..oO(damezumari)
>This is how I do a backup of a mysql database with php: > > $backupFile = '/home/owner/dbbackup/'.$dbname .'-' .$filename. >'.sql'; > $command = "mysqldump --opt -h $dbhost -u $dbuser -p$dbpass $dbname> >$backupFile"; > $dummy = system($command, $retval); > >It works OK and creates a .sql file, but how do I compress the file to >a gzip file? Use the command line. Pass the result of mysqldump to gzip and then redirect it to a file: $command = "mysqldump --opt -h$dbhost -u$dbuser -p$dbpass $dbname | gzip > $backupFile.gz"; Micha |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Thank you for your answers!
Kind regards, Jan Nordgreen |
|
![]() |
| Outils de la discussion | |
|
|