Advertisement
mqnoy

backupmysql.php

Jan 14th, 2019
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | None | 0 0
  1. <?php
  2. #
  3. # source : https://gist.github.com/micc83/fe6b5609b3a280e5516e2a3e9f633675
  4. #
  5.  
  6. ini_set('display_errors', 1);
  7. ini_set('display_startup_errors', 1);
  8. error_reporting(E_ALL);
  9.  
  10. $database = 'namadb';
  11. $user = 'user';
  12. $pass = 'pass';
  13. $host = 'localhost';
  14. #$dir = dirname(__FILE__) . '/dump.sql';
  15. $dir = '/var/www/html/dump.sql';
  16. echo "<h3>Backing up database to `<code>{$dir}</code>`</h3>";
  17.  
  18. exec("mysqldump --user={$user} --password={$pass} --host={$host} {$database} logger  --result-file={$dir} 2>&1", $output);
  19.  
  20. var_dump($output);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement