Welcome Guest, Not a member yet? Register   Sign In
Allowed memory size exhausted while uploading - Common.php on line 358
#1

[eluser]Unknown[/eluser]
I noticed there are similar questions but I have tried the proposed solutions and could not come up with a solution.

Here is my development environment:

PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli)
Server version: Apache/2.2.22 (Ubuntu)
Codeigniter_2.1.2
What I'm trying to do is the basic example of the image upload. Here is the controller:

Code:
<?php

class Entry extends CI_Controller {

    function __construct() {
        parent::__construct();
        ini_set('memory_limit', "256M");
    }

    function index() {
        $this->load->view('upload_form');
    }

    function upload() {

        $config['upload_path'] = './uploads/';
        $config['allowed_types'] = 'gif|png|jpg';
        $config['max_size'] = 2048;
        $config['max_width'] = 1024;
        $config['max_height'] = 768;

        $this->load->library('upload', $config);

        if (! $this->upload()->do_upload('file')) {
            $error = array('error' => $this->upload->display_errors());

            $this->load->view('upload_form', $error);
        }
    }

}

?>
And my view file is simply like this:

Code:
<?php
    echo form_open_multipart('entry/upload');
    echo form_upload('file');
    echo form_submit('submit', 'Upload Fille');
?>
In the controller, you can see that I've tried setting memory limit to 256MB, I also tried the -1 option. When I set the memory_limit to -1 the computer ran crazy, it froze ((:

Here is the error that I'm getting when I try to upload sth.

Code:
PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 523800 bytes) in /var/www/giydir/system/core/Common.php on line 358, referer: http://localhost/giydir/entry
The line that the error shows is interesting to me

Code:
$_log =& load_class('Log');
Do anyone have an idea for possible reasons or solution methods?

Best regards




Theme © iAndrew 2016 - Forum software by © MyBB