Подтвердите, что pdo mysql включен в php ini
правильно проверьте код из https://www.codeigniter.com/userguide3/database/utilities.html?
https://www.codeigniter.com/userguide3/database/configuration.html?
попробуйте этот код, он работает на 100%
controller / DATABASE_BACKUP.php
<?php
class DATABASE_BACKUP extends CI_Controller {
public function index()
{
$this->load->database();
// Load the DB utility class
$this->load->dbutil();
// Backup your entire database and assign it to a variable
$backup = $this->dbutil->backup();
// Load the file helper and write the file to your server
$this->load->helper('file');
write_file('mybackup.gz', $backup);
// Load the download helper and send the file to your desktop
$this->load->helper('download');
//force_download('mybackup.gz', $backup);
}
}
?>
моя конфигурация базы данных config / database.php
<?php
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'faker_db',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
?>