symfony1 - Backup MySQL via php, in a Symfony application -
i'm trying php script backup database. here's i've tried far :
$command = "mysqldump -u [username] -p [password] [databasename] | gzip > db.sql.gz"; $this->output = system($command);
how password , username databases.yml ?
how can script sends me backup file, instead of saving on server (à la phpmyadmin) ?
you can create symfony task. if pass in environment (i.e. dev, prod) or connection access doctrine connection manager , create connection. can use connection make database dump or connection details connection manager.
you can use doctrine insert sql task template task. i've done similar in past.
Comments
Post a Comment