Welcome Guest, Not a member yet? Register   Sign In
codeigniter captcha Allowed memory
#1

Hi , im tryng to insert captcha in registration , this is my simple controller method :

Code:
public function captcha_setting(){
       
        $this->load->helper('captcha');

       
       $vals = array(
           'img_path' => '.images/',
           'img_url' => base_url().'images/',
       );
       
       
        $data = create_captcha($vals);
       
        $_SESSION['captchaWord'] = $data['word'];
       
        $this->captcha_setting();


        // image will store in "$data['image']" index and its send on view page
        $this->load->view('captcha_view', $data);
     }


If i visit the page captcha_view :

Code:
<?php

echo $image;


?>


I have this error  :

Message: Allowed memory size of 268435456 bytes exhausted (tried to allocate 65484 bytes)
Reply
#2

(06-25-2017, 07:16 AM)pippuccio76 Wrote: Hi , im tryng to insert captcha in registration , this is my simple controller method :

Code:
public function captcha_setting(){
       
        $this->load->helper('captcha');

       
       $vals = array(
           'img_path' => '.images/',
           'img_url' => base_url().'images/',
       );
       
       
        $data = create_captcha($vals);
       
        $_SESSION['captchaWord'] = $data['word'];
       
        $this->captcha_setting();


        // image will store in "$data['image']" index and its send on view page
        $this->load->view('captcha_view', $data);
     }


If i visit the page captcha_view :

Code:
<?php

echo $image;


?>


I have this error  :

Message: Allowed memory size of 268435456 bytes exhausted (tried to allocate 65484 bytes)

php has a memory limit. you used too much. it has nothing to do with the captcha Smile

change the allowed memory in php.ini (memory_limit) or unset unnecessary arrays
Reply
#3

(06-25-2017, 08:34 AM)Paradinight Wrote:
(06-25-2017, 07:16 AM)pippuccio76 Wrote: Hi , im tryng to insert captcha in registration , this is my simple controller method :

Code:
public function captcha_setting(){
       
        $this->load->helper('captcha');

       
       $vals = array(
           'img_path' => '.images/',
           'img_url' => base_url().'images/',
       );
       
       
        $data = create_captcha($vals);
       
        $_SESSION['captchaWord'] = $data['word'];
       
        $this->captcha_setting();


        // image will store in "$data['image']" index and its send on view page
        $this->load->view('captcha_view', $data);
     }


If i visit the page captcha_view :

Code:
<?php

echo $image;


?>


I have this error  :

Message: Allowed memory size of 268435456 bytes exhausted (tried to allocate 65484 bytes)

php has a memory  limit. you used too much. it has nothing to do with the captcha  Smile

change the allowed memory in php.ini (memory_limit) or unset unnecessary arrays

Sorry but ther'is another problem , several image are saved until i have this problem (instead one image ) . i think this is the problem , but howcan i solve ?
Reply
#4

(06-25-2017, 01:30 PM)pippuccio76 Wrote:
(06-25-2017, 08:34 AM)Paradinight Wrote:
(06-25-2017, 07:16 AM)pippuccio76 Wrote: Hi , im tryng to insert captcha in registration , this is my simple controller method :

Code:
public function captcha_setting(){
       
        $this->load->helper('captcha');

       
       $vals = array(
           'img_path' => '.images/',
           'img_url' => base_url().'images/',
       );
       
       
        $data = create_captcha($vals);
       
        $_SESSION['captchaWord'] = $data['word'];
       
        $this->captcha_setting();


        // image will store in "$data['image']" index and its send on view page
        $this->load->view('captcha_view', $data);
     }


If i visit the page captcha_view :

Code:
<?php

echo $image;


?>


I have this error  :

Message: Allowed memory size of 268435456 bytes exhausted (tried to allocate 65484 bytes)

php has a memory  limit. you used too much. it has nothing to do with the captcha  Smile

change the allowed memory in php.ini (memory_limit) or unset unnecessary arrays

Sorry but ther'is another problem , several image are saved until i have this problem (instead one image ) . i think this is the problem , but howcan i solve ?

Can someone tell me why several image (until problem of error memory) are saved ?
Reply
#5

php.ini

Try changing these:

memory_limit=256M

For Forms / upload/download:
These two settings should be set to the same amount.

post_max_size=16M
and
upload_max_filesize=16M
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#6

(06-30-2017, 04:23 AM)InsiteFX Wrote: php.ini

Try changing these:

memory_limit=256M

For Forms / upload/download:
These two settings should be set to the same amount.

post_max_size=16M
and
upload_max_filesize=16M

Ther'isnt a problem of memory , this appear because ther's something  as a loop wich save image until the memory_limit are reached, the problem is why ?
Reply
#7

(06-30-2017, 09:20 AM)pippuccio76 Wrote:
(06-30-2017, 04:23 AM)InsiteFX Wrote: php.ini

Try changing these:

memory_limit=256M

For Forms / upload/download:
These two settings should be set to the same amount.

post_max_size=16M
and
upload_max_filesize=16M

Ther'isnt a problem of memory , this appear because ther's something  as a loop wich save image until the memory_limit are reached, the problem is why ?

show us the code.
Reply
#8

(This post was last modified: 06-30-2017, 12:22 PM by pippuccio76.)

(06-30-2017, 10:18 AM)Paradinight Wrote:
(06-30-2017, 09:20 AM)pippuccio76 Wrote:
(06-30-2017, 04:23 AM)InsiteFX Wrote: php.ini

Try changing these:

memory_limit=256M

For Forms / upload/download:
These two settings should be set to the same amount.

post_max_size=16M
and
upload_max_filesize=16M

Ther'isnt a problem of memory , this appear because ther's something  as a loop wich save image until the memory_limit are reached, the problem is why ?

show us the code.

the code is on the first post :

Code:
// This function generates CAPTCHA image and store in "image folder".
     public function captcha_setting(){
       
      $this->load->helper('captcha');

       
       $vals = array(
           'img_path' => './captcha/',
           'img_url' => base_url().'captcha/',
       );
       
       
        $data = create_captcha($vals);
       
        $_SESSION['captchaWord'] = $data['word'];
       
        $this->captcha_setting();


        // image will store in "$data['image']" index and its send on view page
        $this->load->view('captcha_view', $data);
     }

this is capcha_view:

Code:
<?php

echo $image;


?>

in the folder captcha there are more than 100 image created in one minute
Reply
#9

There should not be a loop it only shows one image at a time.

I would read the Documentation more.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#10

(This post was last modified: 06-30-2017, 01:07 PM by pippuccio76.)

(06-30-2017, 12:54 PM)InsiteFX Wrote: There should not be a loop it only shows one image at a time.

I would read the Documentation more.

this is the page with the code :

http://lemuria.altervista.org/user_codei...ha_setting

the code in this page are only :

Code:
<?php

echo $image;


?>
Reply




Theme © iAndrew 2016 - Forum software by © MyBB