i've been using captcha for codeigniter i working fine on my PC but somehow when i uploaded to the server it not generating the image, i've been trying with suggestion from other post from stackoverflow but it doesn't work
I've been check below point
- GD is already enable
- i already do the chmod 755 to assets directory with recursive mode
Please find below my code in controller
public function captcha_config() {
$this->load->helper(array('captcha','form'));
$vals = array(
'img_path' => '/var/www/html/assets/files/captcha/',
'img_url' => base_url().'assets/files/captcha/',
'img_width' => 150,
'img_height' => 30,
'expiration' => 7200
);
$cap = create_captcha($vals);
$this->session->set_userdata('capt',md5($cap['word']));
$image = $cap['image'];
//$data['captcha_img'] = $cap['image'];
//return $image;
var_dump($cap); //it shown bool(false)
}
the result is
bool(false)
I've been change the path into this below, but also not working.
./assets/files/captcha/
-------------------------- Update 06-04-2016 --------------------------------
I got another clue
After i do debugging in helper (captcha_helper) i change some return False to be debugging mode. it shown following error
Message: imagejpeg(/var/www/html/assets/files/captcha/1465012057.5767.jpg): failed to open stream: Permission denied
I've done change the captcha directory to be chmod 777 but it seems doesn't work.
i've done change the ownership to be apache, i'm using this script to check the ownership from web, but still doesn't work ?
<?php echo exec('whoami'); ?>
Why the captcha cannot write into that directory ?