简体   繁体   English

Codeigniter升级2.2.2至3.0将会话移动到文件系统

[英]Codeigniter Upgrade 2.2.2 to 3.0 moving sessions to filesystem

I've been following the upgrade guide documented here and have reached the section concerning the new session storage mechanisms. 我一直在遵循此处记录的升级指南并已到达有关新会话存储机制的部分。

In the past, my application has stored sessions in the database, but I've opted to move this to the file system as recommended in the documentation. 过去,我的应用程序已将会话存储在数据库中,但是我选择按照文档中的建议将其移动到文件系统中。

After initially following the upgrade documentation, I was having problems so I restarted with a fresh copy of the config.php file (the stock version supplied with 3.0) and have changed the following variables (You can assume that anything else in the config not shown below remains as its default value): 在最初遵循升级文档之后,我遇到了问题,因此我重新启动了config.php文件(3.0附带的原始版本)的新副本,并更改​​了以下变量(您可以假定配置中的其他内容未显示)以下仍然是其默认值):

$config['base_url'] = 'http://www.domain.com/';
$config['encryption_key'] = 'mykey';

/* default settings omitted */

$config['sess_driver'] = 'files'; 
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'application/session_storage';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

I've created a directory located at /application/session_storage/ to hold the sessions and changed its file permissions to 700 but something still doesn't appear to be correct as I am getting a database error indicating that the database table isn't in the right format. 我已经在/application/session_storage/创建了一个目录来保存会话,并将其文件权限更改为700,但是由于我收到数据库错误指示数据库表不在其中,因此某些东西似乎仍然不正确。正确的格式。

Am I correct in thinking that by opting to use the file system for session storage, the database is not required at all? 我是否正确地认为通过选择使用文件系统进行会话存储而根本不需要数据库? and if this is the case, can anyone tell me why CI still trying to input data into it? 如果是这种情况,谁能告诉我为什么CI仍在尝试向其中输入数据?

It appears that when I followed Step 2 of the upgrade guide which states "Replace all files and directories in your system folder" it was not sufficient to simply drag and drop the directory into FileZilla on top of the existing folder. 看来,当我按照升级指南的步骤2指出“替换系统文件夹中的所有文件和目录”时,仅将目录拖放到现有文件夹顶部的FileZilla中是不够的。

On comparing the system files, I now appear to have a combination of files from 2.2.2 and 3.0 and this seems to be causing conflicts. 在比较系统文件时,我现在似乎拥有2.2.2和3.0中文件的组合,这似乎引起了冲突。 In particular, the file located at system/libraries/Session.php 特别是,该文件位于system/libraries/Session.php

I've deleted the folder and re-uploaded it and this has solved all problems. 我已经删除了该文件夹并重新上传了它,这已经解决了所有问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM