dtrphb5597
2017-02-20 11:35
浏览 68

CodeIgniter 3 + Docker - 会话

I'm migrating my CodeIgniter 3 app into Docker and I have session issue. I can't login to app, because of CI sessions.

It seems like CodeIgniter recreates new session with each request to the server. When I checked what $_COOKIE contains i can see two fields:

PHPSESSID - always the same (i even tried manually start php session)
ci_session - changes with every request

Files for new sessions are created by www-data user and have right permissions.

Session config:

$config['base_url'] = 'http://localhost';

$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = sys_get_temp_dir();
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

$config['cookie_prefix']    = '';
$config['cookie_domain']    = '';
$config['cookie_path']      = '/';
$config['cookie_secure']    = FALSE;
$config['cookie_httponly']  = FALSE;

Docker images: php:7.1-fpm, nginx:latest, mysql:latest

I haven't idea what's going on. Can anybody help me?

图片转代码服务由CSDN问答提供 功能建议

我正在将我的CodeIgniter 3应用程序迁移到Docker中,我遇到了会话问题。 由于CI会话,我无法登录到应用程序。

似乎CodeIgniter会根据对服务器的每个请求重新创建新会话。 当我检查 $ _ COOKIE 包含的内容时,我可以看到两个字段:

  PHPSESSID  - 总是一样的(我甚至尝试手动启动php会话)
ci_session  - 对每个请求进行更改
   
 
 

新会话的文件由 www-data 用户创建并具有正确的权限。 \ 会议配置:

  $ config ['base_url'] ='http:// localhost'; 
 
 $ config ['sess_driver']  ='files'; 
 $ config ['sess_cookie_name'] ='ci_session'; 
 $ config ['sess_expiration'] = 7200; 
 $ config ['sess_save_path'] = sys_get_temp_dir(); 
 $ config [  'sess_match_ip'] = FALSE; 
 $ config ['sess_time_to_update'] = 300; 
 $ config ['sess_regenerate_destroy'] = FALSE; 
 
 $ config ['cookie_prefix'] =''; 
 $ config  ['cookie_domain'] =''; 
 $ config ['cookie_path'] ='/'; 
 $ config ['cookie_secure'] = FALSE; 
 $ config ['cookie_httponly'] = FALSE; 
 <  / code>  
 
 

Docker镜像: php:7.1-fpm nginx:latest mysql:latest

我 我不知道发生了什么。 有人可以帮帮我吗?

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

1条回答 默认 最新

  • dqxyh48864 2017-02-20 12:08
    已采纳

    OK, problem solved.

    I must update CodeIgniter to older version, because of currently installed isn't compatible with PHP 7.1 (only with 7.0).

    打赏 评论

相关推荐 更多相似问题