CodeIgniter Forums
ini_set(): A session is active - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: ini_set(): A session is active (/showthread.php?tid=76598)



ini_set(): A session is active - fabianoc - 05-30-2020

Code:
Severity: Warning

Message: ini_set(): A session is active. You cannot change the session module's ini settings at this time

Filename: Session/Session.php

Line Number: 282

My system : 
PHP 7.3.11 on Mac OS Catalina

After upgrading from CI 2.2.1 to 3.1.11 version I keep getting these Warnings, I have no session_start() calls in my code, if I set ENVIRONMENT = production the warnings stop, I need to keep ENVIRONMENT = development to test the app but I can't remove these warnings from sessions.

My Session config:
PHP Code:
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'credsession';
$config['sess_expiration'] = 0;
$config['sess_save_path'] = sys_get_temp_dir();
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE

I tried commenting session_start() on line 143 of "system/libraries/Session/Session.php" and the warnings stop, but I don't think that's a good solution.
I removed the system folder and pasted the system 3.1.11 version into my app, followed all upgrading instructions on https://www.codeigniter.com/userguide3/installation/upgrade_300.html 

Could this be a php 7.3.11 problem?


RE: ini_set(): A session is active - jreklund - 06-01-2020

Do you load the session library multiple times? If you need it everywhere you should only use the autoload.


RE: ini_set(): A session is active - fabianoc - 06-01-2020

(06-01-2020, 01:58 PM)jreklund Wrote: Do you load the session library multiple times? If you need it everywhere you should only use the autoload.

No, only 'autoload'


RE: ini_set(): A session is active - InsiteFX - 06-02-2020

Did you replace the complete session folder under system?

Either that or like @jrelund is stating is that you are starting the session in another place
in your code.


RE: ini_set(): A session is active - fabianoc - 06-02-2020

Yes, I removed the system folder and replaced with the 3.1.11 folder after that, I'm not calling session_start() anywhere else in my project, as I said, I only call session in 'autoload' file


RE: ini_set(): A session is active - InsiteFX - 06-02-2020

Create a MY_Controller and extend the Home Controller from the MY_Controller.

Take the session out of autoload and load it in the MY_Controller and see if
the problem changes. I' am just trying to see if the problem has to do with
the session being autoloaded.


RE: ini_set(): A session is active - dave friend - 06-02-2020

(06-02-2020, 04:38 AM)fabianoc Wrote: I'm not calling session_start() session_start() else in my project, as I said, I only call session in 'autoload' file

"anywhere else"??? Meaning that you do explicitly call session_start()?


RE: ini_set(): A session is active - fabianoc - 06-02-2020

No, I don't
There's no call in the whole project


RE: ini_set(): A session is active - dave friend - 06-03-2020

(06-02-2020, 02:58 PM)fabianoc Wrote: No, I don't
There's no call in the whole project
Good to know.

But you do load session in application/config/autoload.php using a call something like this?

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

(There may be other items in the array, but that is not important.)


RE: ini_set(): A session is active - fabianoc - 06-03-2020

Exactly! That's the only place I load Session Lib

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