session error in codeigniter?

In config.php sess_save_path should be sys_get_temp_dir(); then it will resolve the error of mkdir(): Invalid path


Sharing a solution that helped me, try set your config variable like:

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

The reason you encountered the error is because you didn't have a $config['sess_save_path']

Go to you config.php and set

$config['sess_save_path'] = NULL;

This error comes when we use directory bases session approach in CodeIgniter. If we use database based session approach error will go. Use code below -

change your application->config->config.php and set

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

& Run SQL query

CREATE TABLE IF NOT EXISTS `ci_sessions` (
        `id` varchar(40) NOT NULL,
        `ip_address` varchar(45) NOT NULL,
        `timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
        `data` blob NOT NULL,
        PRIMARY KEY (id),
        KEY `ci_sessions_timestamp` (`timestamp`)
);