Issue
This code:
{
$this->load->helper('form');
$this->load->helper('captcha');
// Captcha configuration
$config = array(
'img_path' => 'captcha/',
'img_url' => base_url().'captcha/',
'img_width' => '150',
'img_height' => 50,
'word_length' => 3,
'font_size' => 35,
'pool' => '0123456789',
);
$captcha = create_captcha($config);
// Unset previous captcha and store new captcha word
$this->session->unset_userdata('captchaCode');
$this->session->set_userdata('captchaCode',$captcha['word']);
// Send captcha image to view
$data['captchaImg'] = $captcha['image'];
$this->load->view('Login', $data);
}
generates captcha very well in windows, image created in captcha folder and showed in view. The problem is that I moved my Codeiniter website to linux, CentOs7, I changed the www folder permission to 777 and the owner is apache but still no image is created in captcha folder and of course no captcha image appears in view.
ls -ld www ===> drwxrwxrwx. 4 apache apache 33 Jun 11 17:18 www
ls -ld www/html/CodeIgniter-3.1.3/captcha/ =======>
drwxrwxrwx. 2 apache apache 6 Jun 15 06:06 www/html/CodeIgniter-3.1.3/captcha/
Solution
I found the problem, CentOS has SELinux enabled by default. I choose the easy way to disable SELinux and now everything works fine.
sudo gedit /etc/sysconfig/selinux
change
SELinux=enforcing to SELinux=disabled
Answered By - Saeed J Answer Checked By - Gilberto Lyons (WPSolving Admin)