SHARE
TWEET

Untitled

a guest Oct 10th, 2019 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/php
  2. <?php
  3. #create directory based on date
  4. $path = '~/your_directory/'.date('Y-m-d');
  5. #check directory existance
  6. if (!file_exists($path))
  7.     mkdir($path, 0777, true);
  8.  
  9. #initiate database information
  10. $database = 'yourdatabase';
  11. $user = 'youruser';
  12. $pass = 'yourpassword';
  13. $host = 'localhost';
  14. #
  15. $dir = $path . '/dump.sql';
  16. echo "<h3>Backing up database to `<code>{$dir}</code>`</h3>";
  17. exec("mysqldump --user={$user} --password={$pass} --host={$host} {$database} --result-file={$dir} 2>&1", $output);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top