N
N
Nik_Set_72017-07-20 15:02:50
CodeIgniter
Nik_Set_7, 2017-07-20 15:02:50

Why sessions are not saved in the database?

The problem is: when specifying in application/config/config.php, saving sessions in files, everything works, sessions are created.
When specifying in the same file to save sessions in the database, an An uncaught Exception was encountered error appears. What could be the problem if I connect without errors and display data from the database, and also created a table for documentation sessions?

CREATE TABLE IF NOT EXISTS `ci_sessions` (
  session_id varchar(40) DEFAULT '0' NOT NULL,
  ip_address varchar(16) DEFAULT '0' NOT NULL,
  user_agent varchar(120) NOT NULL,
  last_activity int(10) unsigned DEFAULT 0 NOT NULL,
  user_data text NOT NULL,
  PRIMARY KEY (session_id),
  KEY `last_activity_idx` (`last_activity`)
);

$config['encryption_key'] = '';

$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = true;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = true;

$config['cookie_prefix']	= '_My';
$config['cookie_domain']	= 'http://www.citest.ru';
$config['cookie_path']		= '/';
$config['cookie_secure']	= FALSE;
$config['cookie_httponly'] 	= FALSE;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dmitriy, 2017-07-20
@dmitriylanets

$config['cookie_domain']
is not what it should be

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question