【问题标题】:Codeigniter does not generates Captcha in CentOS 7, but works in windowsCodeigniter 在 CentOS 7 中不生成验证码,但在 windows 中工作
【发布时间】:2017-06-15 13:37:49
【问题描述】:

这段代码:

{
    $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);
}

在 Windows 中很好地生成验证码,图像在验证码文件夹中创建并显示在视图中。 问题是我将我的 Codeiniter 网站移动到 linux CentOs7,我将 www 文件夹权限更改为 777,所有者是 apache,但在验证码文件夹中仍然没有创建图像,当然也没有验证码图像出现在视图中。

 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/ 

【问题讨论】:

    标签: captcha codeigniter-3 centos7 chmod chown


    【解决方案1】:

    我发现了问题,CentOS 默认启用了 SELinux。我选择了禁用 SELinux 的简单方法,现在一切正常。

    sudo gedit /etc/sysconfig/selinux
    

    改变

    SELinux=enforcing to SELinux=disabled
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-01
      • 1970-01-01
      • 2013-03-13
      • 1970-01-01
      • 2012-07-04
      • 2011-09-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多