Problems with login persistence and sessions

Re: Problems with login persistence and sessions

by Martin Dougiamas -
Number of replies: 4
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Ah, I worked it out smile

The trouble is Sourceforge is a cluster of servers, so the sessions are stored on a random machine.

The fix is to create a directory for sessions, make it world-read/writeable, then put a .htaccess file in the root of moodle containing something like:

php_value session.save_path "/home/groups/m/mo/moodle/sessions"
(or whatever your path is)

Moodle is working great for me now on Sourceforge. Perhaps explicitly setting the sessions path will help on your Windows box too.
In reply to Martin Dougiamas

Re: Problems with login persistence and sessions

by Dick Davies -

Unfortunately my hosting co has disabled .htaccess so I can't do that, Their preferred solution is to use a replacement database based session - I only need to know where to put the function so it will be included in all pages before the headers are set - am I right in assuming I can put it in config.php?? 

 

In reply to Martin Dougiamas

Re: Problems with login persistence and sessions

by Dick Davies -

I'm still looking at how to integrate database sessions. I have some code for mySQL which I could put in "no problem" (inasmuch that any new snippets are!) , but that wouldn't help anyone else.

I notice that the ado library has inbuilt sessions and crypto sessions code - would it be a big job to integrate these?  I don't speak ado'ish - but wouldn't it simply mean changing the basic variables to use the moodle CFG-> variables.

Anybody any input?

 

 

In reply to Dick Davies

Re: Problems with login persistence and sessions

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I've not got much time to look at it now, but this may help:

http://php.weblogs.com/adodb-sessions

From the looks of it the only thing that needs modification is moodle/lib/setup.php.

I'm intending to revisit ADOdb in some detail for Moodle 1.1, to make use of their new "database dictionary" capability (which will mean Moodle can truly support all databases out of the box, even to create and modify tables). At the same time I'll likely revisit database-based sessions too ... there's a bit more to it than just the hack itself, there might be some issues in switching to this method across the board, but this would certainly fix a whole bunch of little problems at once.
In reply to Martin Dougiamas

Re: Problems with login persistence and sessions

by Jeff Wing -

I am having the same kind of login problems. When you log in it says you are not logged in and takes me back to the login page. At the bottom of the log in page it says that I am logged in, and all of the site content is available.

I tried the session directory fix, created a session dir and added .htaccess. I verified that sessions are being stored in that directory but it doesn't fix the problem. Also turned off secure forms trying to make everything as generic as possible, and don't have any firewall software installed.

Here's where it gets really weird. After browsing several links on the site I get a 404 error, page can't be found. I can close the browser (IE6 or NS7) completely and reopen it and still can't access the site. So then I delete cookies in the browser and everything works again, for awhile...til the 404 error pops up again.

Server Details:
Apache Version -
1.3.27 (Unix)
PHP Version       - 4.3.1
MySQL Version  - 4.0.13

I hope someone can shed some light on this problem....