Backup your MySQL database from php

  • Gérald Barré

Here is a PHP script to save a database in a gzip archive.

  // change the following values
  $host= '';
  $user= '';
  $pass= '';
  $db=   '';
  $d=    date('Y-m-d-H-i');

  $backup_folder= 'backup';

    'mysqldump --opt -h%s -u%s -p"%s" %s | gzip > %s/db-%s.sql.gz',

Do you have a question or a suggestion about this post? Contact me!

Follow me:
Enjoy this blog?Buy Me A Coffee💖 Sponsor on GitHub