Active session problem

Are you responsible for making OCS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, michael, John

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.
pkorduan
Posts: 2
Joined: Tue Sep 09, 2008 5:46 am

Active session problem

Postby pkorduan » Tue Sep 09, 2008 6:06 am

Hallo, I'm new to ocs,

After setting up the site I get the error msg

    Warning: ini_set() [function.ini-set]: A session is active. You cannot change the session module's ini settings at this time. in /www/preagro/ocs-2.1.0-1/classes/session/SessionManager.inc.php on line 36
    Warning: ini_set() [function.ini-set]: A session is active. You cannot change the session module's ini settings at this time. in /www/preagro/ocs-2.1.0-1/classes/session/SessionManager.inc.php on line 37
    Notice: A session had already been started - ignoring session_start() in /www/preagro/ocs-2.1.0-1/classes/session/SessionManager.inc.php on line 57
    Warning: Cannot modify header information - headers already sent by (output started at /www/preagro/ocs-2.1.0-1/classes/session/SessionManager.inc.php:36) in /www/preagro/ocs-2.1.0-1/classes/template/TemplateManager.inc.php on line 292
    Warning: Cannot modify header information - headers already sent by (output started at /www/preagro/ocs-2.1.0-1/classes/session/SessionManager.inc.php:36) in /www/preagro/ocs-2.1.0-1/classes/template/TemplateManager.inc.php on line 295

If I try a second time I get additionally the followin line:
    DB Error: Duplicate entry '7b438ea1c0c335ac0abdb4b855d6610a' for key 1

I resumed that a session is running already. Its because the PHP ini Variable session.auto_start is ON at my server. And the app wrote the session ID in the session table of ocs already (and try it again)

So i tryed to change the php setting localy with
    ini_set ("session.auto_start", "Off" );
at the first line of index.php and close an open session with
    session_write_close();

There is no error msg anymore, but it seams that there is also no session anymore, because I can log in, the login will be evaluated correctly, but I end up allways with the login screen.

Are there any common problems known with sessions. Sorry I couldn't find that much about session problems.

My php Version 4.4.5

By the way, my MySQL login for ocs will only work with an OLD_PASSWORD encryption of ocs admin password.
Does ; The encryption (hashing) algorithm to use for encrypting user passwords
means the user in ocs or the user for the mysql database connection with php (or ADO).

Thanks Peter

jmacgreg
Posts: 4191
Joined: Tue Feb 14, 2006 10:50 am
Contact:

Re: Active session problem

Postby jmacgreg » Tue Sep 09, 2008 11:37 am

Hi Peter,

You are correct on your first problem -- this is from docs/FAQ:

6) "Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time" messages appear when I load OCS.

A: Check if session.auto_start is enabled in your php.ini configuration. OCS requires this setting to be disabled, which is the default behaviour in current versions of PHP.


If you remove session_write_close(); can you proceed further than the login page?

By the way, my MySQL login for ocs will only work with an OLD_PASSWORD encryption of ocs admin password.
Does ; The encryption (hashing) algorithm to use for encrypting user passwords
means the user in ocs or the user for the mysql database connection with php (or ADO).


I'm not sure what you mean here. Is this a freshly installed version of OCS? If so, which encryption setting did you set it to -- MD5 or SHA1?

Cheers,
James

pkorduan
Posts: 2
Joined: Tue Sep 09, 2008 5:46 am

Re: Active session problem

Postby pkorduan » Fri Sep 12, 2008 5:45 am

Hi,

Thanks for reply.
If i remove session_write_close(), i ended up exactly as described in the FAQ 6 with the "A session is active" warning.
Sorry that i did not read this.
If i set session.auto_start to "Off" in the php.ini ocs works fine, but i need it to "On" for other apps of my apache-php installation.

Now the question is more php related i think. How can i use ocs with session.auto_start ON ?
I try to set the variable with ini_set ("session.auto_start", "Off" ); at runtime, but if i do so a session is running allready. So i tryed to close it bevor osc starts by typing session_write_close() at the beginning of the index.php.

But its not enough, i also have to destroy the session and Cookie. What now work is this as the first section in index.php

Code: Select all

// Unset all of the session variables.
$_SESSION = array();

// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (isset($_COOKIE[session_name()])) {
    setcookie(session_name(), '', time()-42000, '/');
}
// Finally, destroy the session.
session_destroy();


Thanks php.net for that.

Forget the other part of the question. I can fix it.

Thank you.

asmecher
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm
Contact:

Re: Active session problem

Postby asmecher » Fri Sep 12, 2008 9:36 am

Hi pkorduan,

Unfortunately, you can't use ini_set to override the session.auto_start setting, as this setting takes effect before any PHP code starts running. However, you might be able to override it using something like the following in a .htaccess file in your installation directory:

Code: Select all

php_flag session.auto_start 0
This may or may not be supported, depending on your server configuration.

Regards,
Alec Smecher
Public Knowledge Project Team


Return to “OCS Technical Support”

Who is online

Users browsing this forum: No registered users and 1 guest