I want to take a backup of my database. My CodeIgniter version is 3.0.1 And when I run the code, it just load for some time and then just blanks out. My database size is greater than 60MB. Nothing happened. My code is given below.
{
// Load the DB utility class
$this->load->database();
$this->load->dbutil();
// $dbs = $this->dbutil->list_databases();
$prefs = array(
//'tables' => array('hotel_accomodation'), // Array of tables to backup.
'ignore' => array(), // List of tables to omit from the backup
'format' => 'txt', // gzip, zip, txt
'filename' => ''.date("Y-m-d-H-i-s").'-mybackup.sql', // File name - NEEDED ONLY WITH ZIP FILES
'add_drop' => TRUE, // Whether to add DROP TABLE statements to backup file
'add_insert' => TRUE, // Whether to add INSERT data to backup file
'newline' => "\n" // Newline character used in backup file
);
$backup = $this->dbutil->backup($prefs);
// print_r($backup);
// die;
// var_dump($backup);
// Load the file helper and write the file to your server
$this->load->helper('file');
write_file(base_url().'download/mybackup.gz', $backup);//file directory ka issue lag ra hy mujhy is ki access ka ya kuch... ya phir database ka size zia
// Load the download helper and send the file to your desktop
$this->load->helper('download');
force_download('mybackup.gz', $backup);
} ```