Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter Session Error - Unlink Operation not Permitted

I'm trying to debug this CodeIgniter issue I am having with my application. I cannot figure it out so I was wondering if anyone else has come across this and could shed some light on it?

This occurs randomly when a user is logged in. The user could be browsing and all of a sudden this error pops up. Refresh the browser and it's gone.

CodeIgniter 3

Thanks!

A PHP Error was encountered

Severity: Warning

Message: unlink(/tmp/ci_session0189a7f1c86eb18fb70afcfedc2d5040e9c23146): Operation not permitted

Filename: drivers/Session_files_driver.php

Line Number: 346

Backtrace:

File: /home/*****/public_html/application/controllers/User.php
Line: 5
Function: __construct

File: /home/*****/public_html/index.php
Line: 292
Function: require_once
like image 527
Mercy Avatar asked Mar 26 '15 12:03

Mercy


3 Answers

After doing some more research I found the issue and the answer.

In the config.php file you MUST set sess_save_path to a valid path. It was initially set to NULL. I have mine set to:

 $config['sess_save_path'] = BASEPATH . 'cache/';

Now the sessions are being saved in this folder and can be unlinked when needed to.

like image 129
Mercy Avatar answered Oct 16 '22 08:10

Mercy


I change on "application/config/config.php" :

$config['sess_save_path'] = NULL;

To:

 $config['sess_save_path'] = APPPATH . 'cache'; (or another folder)

location folder "cache" is "application/cache".

like image 8
Gaalih Avatar answered Oct 16 '22 08:10

Gaalih


change application > config > config.php

$config['sess_save_path'] =  BASEPATH . 'cache/';
like image 6
Pervez Avatar answered Oct 16 '22 08:10

Pervez