-
pippuccio76
Senior Member
-
Posts: 507
Threads: 214
Joined: Jun 2017
Reputation:
2
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)
-
Paradinight
Senior Member
-
Posts: 445
Threads: 6
Joined: Jun 2015
Reputation:
25
(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
change the allowed memory in php.ini (memory_limit) or unset unnecessary arrays
-
pippuccio76
Senior Member
-
Posts: 507
Threads: 214
Joined: Jun 2017
Reputation:
2
(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
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 ?
-
pippuccio76
Senior Member
-
Posts: 507
Threads: 214
Joined: Jun 2017
Reputation:
2
(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
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 ?
-
InsiteFX
Super Moderator
-
Posts: 6,503
Threads: 323
Joined: Oct 2014
Reputation:
239
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 )
-
pippuccio76
Senior Member
-
Posts: 507
Threads: 214
Joined: Jun 2017
Reputation:
2
06-30-2017, 12:20 PM
(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
-
pippuccio76
Senior Member
-
Posts: 507
Threads: 214
Joined: Jun 2017
Reputation:
2
06-30-2017, 01:07 PM
(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;
?>
|