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

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -