Welcome Guest, Not a member yet? Register   Sign In
Out of memory for backup
#1

[eluser]fs_xyz[/eluser]
Hi there,
I got a problem regarding backup. It used to be fine... Last time I used was about a week ago.
Here is the script I use :
Code:
<?php
class BackupDatabase extends Controller {

    function __construct()
    {
        parent::Controller();
        $this->load->helper('download');
        $this->load->helper('file');        
        $this->load->dbutil();                
    }
    
    function index()
    {
        $now = date("d-m-Y H:i:s");
        $prefs = array(
            'format'      => 'gz',
            'filename'    => 'backup '.$now.'.sql',
            'add_drop'    => TRUE,              
            'add_insert'  => TRUE,        
            'newline'     => "\n"
            );
        $this->dbutil->backup($prefs);
        $backup =& $this->dbutil->backup();

        force_download('backup '.$now.'.gz', $backup);        
    }
    
}
?>

I got this error message :
Fatal error: Out of memory (allocated 24903680) (tried to allocate 18361504 bytes) in ../system/database/DB_utility.php on line 347

I wonder what is happening ? If about php.ini... I'm afraid I don't access for that.
I also tried ini_set(), didn't work.
I use patched CI 1.7.2, and I don't think the patch got anything to do with download process.

Can someone help me ? Sorry for the broken english. Thank you in advance.

PS : Uhh, I just realized, I posted in the wrong section. I'm sorry, can anyone move this to the correct one ?
#2

[eluser]WanWizard[/eluser]
The backup method of the database driver creates the output file in memory. Not very useful if you have more than a few records in your tables.

The utility classes desparately need to be rewritten to use disk storage for generating the backup files, so you're not size limited.
#3

[eluser]fs_xyz[/eluser]
Whew.... good to go again. X_X
Thanks for the help.

Eee... one more thing, why I cannot write file output in this way ?
Code:
$now = date("d-m-Y H:i:s");
$backup = 'asdfgsdgfasfgvasgf';
write_file('./backup/filebackup'.$now.'.txt', $backup);
About the date part, whenever I'm trying to write the file with date added to file name, it won't produce file output.
But if I'm not using it, it can. Is there a way so I can write a file with date added to file name ?

Code:
$backup = 'asdfgsdgfasfgvasgf';
write_file('./backup/filebackup.txt', $backup);
This one will produce output.

Is it impossible since the file name will consist of "-" and ":" ?




Theme © iAndrew 2016 - Forum software by © MyBB