CodeIgniter版本3.x:加载“会话”库报告ini_set警告

I am using Codeigniter 3.0.1 in a Wamp64 installation (PHP Ver 5.6.19, Apache 2.4.18) on a Windows Server 2012 R2. When I have the line:

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

in autoload.php I get the following error on startup of my application:

ini_set() A session is active You cannot change the session module's ini settings at this time. Filename: libraries/Session.php Line Number: 313

If I take that line out of autoload.php and put the following line in the contructor function of the controllers that actually use the session data:

$this->load->library("Session")

I get the same error, but only when I start one of those controllers.

I have reviewed multiple answers to this question on stackoverflow:

  • Do you have a session_start() in your php code: NO - I have searched every piece of code included in this project and there is no session_start() anywhere
  • Do you have session.auto_start set equal to 0 (zero) in php.ini - YES

Neither of these answers solves my problem.

Session info is being written out to C:\temp on the server. I see the file is created when I start the controller that first loads the Session library so the web server seems to have write access to the C:\temp folder.

The other interesting thing is that I have no problem with the installation on my test server (Windows 7, php version 5.6.32)

Can anyone offer any suggestions? Thanks!

One more piece of information: This was an upgrade from 2.x to 3.0. I did delete the \system sub folder and replaced it with the V3 \system folder.

Found it.

The issue was an Ajax library (Sijax) which external to Codeigniter instantiated an instance of the class so that the methods could be called via Ajax. The new(class) triggered loading the Session class again, which ran through the initialization and tried to create the session again.

I removed the autoload of the Session class, and moved loading it to the Classes that require it, checking first to see if the Class already exists before calling the loader.