duanbenzan4050
duanbenzan4050
2016-11-19 18:46
浏览 34
已采纳

codeIgniter 3无法从存储的缓存中读取?

I'm getting an error when I refresh my website while on the same page in codeigniter 3. see the PHP error in the image: php error (link http://imgur.com/miOpHIV)

I have the session library in my autoloader, nothing special in my controller and view, not even using sessions there.

Below are my setting in the /application/config/config.php file, I think these are the only settings that are important for this error.

/* Session Variables */

$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'example';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'system/cache';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

/* Cookie Related Variables */
$config['cookie_prefix']    = 'example';
$config['cookie_domain']    = 'example.com';
$config['cookie_path']      = '/';
$config['cookie_secure']    = FALSE;
$config['cookie_httponly']  = FALSE;

I replaced the actual URL with example, if anyone knows how to fix this issue, please let me know. The system/cache file has read and write premissions. The website is managed with plesk.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doucong1268
    doucong1268 2016-11-19 20:52
    已采纳

    Try like with using BASEPATH Because it is for system folder

    $config['sess_driver'] = 'files';
    $config['sess_cookie_name'] = 'example';
    $config['sess_expiration'] = 7200;
    $config['sess_save_path'] = BASEPATH  . 'cache/'; // End with /
    

    APPPATH is for application folder

    $config['sess_driver'] = 'files';
    $config['sess_cookie_name'] = 'example';
    $config['sess_expiration'] = 7200;
    $config['sess_save_path'] = APPPATH . 'cache/'; // End with /
    

    Then try autoloading session. Folder permission for sessions 0700

    点赞 评论

相关推荐