Codeigniter sessions do not work on Live Server

When you open the localhost localhost project, they work correctly and open on the server, and then the wrong path

PHP error occurred

Severity Level: Warning

Message: mkdir (): Invalid path

File Name: drivers / Session_files_driver.php

Line Number: 117

Backtrace:

File: /Library/Server/Web/Data/Sites/garden_worx/index.php Line: 292 Function: require_once

Error 2

An unrelated exception was found

Type: Exception

Message: session: configured save path '' is not a directory, does not exist or cannot be created.

File Name: / Library / Server / Web / Data / Sites / garden _worx / system / libraries / Session / drivers / Session_files_driver.php

Line Number: 119

Backtrace:

File: /Library/Server/Web/Data/Sites/garden_worx/index.php Line: 292 Function: require_once

Error 3

PHP error occurred

Severity Level: Warning

: fopen (6d898f163e36616cef220426dad109225a66f74a): :

: drivers/Session_files_driver.php

: 156

Backtrace:

+5
7

codeigniter 3 , , , chmod 700

.

$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 1440;
$config['sess_save_path'] = FCPATH . 'application/cache/sessions/';
$config['sess_match_ip'] = TRUE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = TRUE;

> config >

$autoload['libraries'] = array('session');

. , , , _ Welcome.php class Welcome extends CI_Controller {}.

Codeigniter doc 2 3 http://www.codeigniter.com/docs

Codeigniter 3 http://www.codeigniter.com/user_guide/libraries/sessions.html

Codeigniter 2: http://www.codeigniter.com/userguide2/libraries/sessions.html

config.php

$config['encryption_key'] = 'pXeQY2733rR560MrwJy40OL4WaSGmr5A';

http://randomkeygen.com/

+10

, :)

config.php

$config['sess_save_path'] = sys_get_temp_dir();

?

+10

, application -> config -> config.php

$config['sess_save_path'] = NULL;

$config['sess_save_path'] = FCPATH.'ci_sessions';

. , ...

+2

$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'] = TRUE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
0

output_buffering = On

php.ini

0
source

adding 'session' to autoload.php file solved my problem

$ autoload ['library'] = array ('form_validation', 'session');

-1
source

This work is for me.

$config['sess_save_path'] = sys_get_temp_dir();

-2
source

Source: https://habr.com/ru/post/1620031/


All Articles