Constantly having to log back in!

Constantly having to log back in!

by Darren Smith -
Number of replies: 17

When I am working as admin I am frequently redirected to log back in after, say, a couple of minutes. The time out on moodle is set to 2 hours. I (and my students) also frequently get internal server errors (500) or cannot connect to server. A simple refresh seems to sort this out. This occurs at both work and home.

I have contacted my webserver tech support guys but they just state that they have checked and there is nothing wrong with there servers.

Any ideas?

Thanks in advance

Darren

Average of ratings: -
In reply to Darren Smith

Re: Constantly having to log back in!

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
"Internal server errors" are definitely a server problem.

"Cannot connect to server" may be a proxy problem.

The loss of sessions (which is making you log in again) is probably a server problem - it can also be because your value for wwwroot in config.php doesn't exactly match the actual site URL, or if the servers are clustered and so you're getting a different server each time.
Average of ratings: Useful (1)
In reply to Martin Dougiamas

Re: Constantly having to log back in!

by Chris Neaves -

Martin do you think this problem is also my problem as posted in this forum post??

http://moodle.org/mod/forum/discuss.php?d=4774

From the post...

I have 2 moodle sites on running on a shared server but with a dedicated IP address, the other on a shared server with shared IP  or name-based Virtual Host Support.

Problem is the shared ip site logs you out after less than 1 hr, I have both sites the same, both have the same PHP Info, this is as far as I can see the only difference.

Could it be the problem, should I change to a dedicated IP? Advice is really really needed as I need to use the shared IP site as its so much faster with more redundancy, so is anyone out there had this problem or has knowledge of this being a problem please reply.

In reply to Martin Dougiamas

Re: Constantly having to log back in!

by Darren Smith -

Thanks for your reply. When you say the internal server errors are definitely a server problem could you give me a little more to go on as my web host support say they can't see anything wrong and they and I can't see anything in the logs.

As for the loss of sessions which is causing the most problems at the moment my site is http://www.icthelp.biz/moodle and the line in config.php is:

$CFG->wwwroot   = 'http://www.icthelp.biz/moodle';

This URL is 'mapped' to my main domain www.planetsmith.co.uk but I can't see how that should be a problem. Any more thoughts / comments please

Thanks

Darren

In reply to Darren Smith

Re: Constantly having to log back in!

by Thomas Robb -
This might be off the wall, but have you taken a look at the cookies in your browser? Could it be that the two different domain names are somehow getting confused, so that the cookies are labelled with one domain name but the browser URL is showing another? If so, then Moodle wouldn't be able to find the cookie and would assume that you aren't logged in.
In reply to Thomas Robb

Re: Constantly having to log back in!

by Darren Smith -

Thanks for the reply.

I have had a look at the cookies and the name of the cookie remains myusername@www.icthelp.biz and when I open the cookie in notepad among the unreadable stuff is the url www.icthelp.biz sad nice thought though 

If I am really quick I can edit as admin - it is only if it has stood for a couple of minutes.

Darren

In reply to Darren Smith

Re: Constantly having to log back in!

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
That's the problem: your wwwroot should be http://icthelp.biz/moodle 

Notice what happens when you go to http://www.icthelp.biz/moodle (without the slash) ... you get redirected to the "natural" address.
Average of ratings: Useful (1)
In reply to Martin Dougiamas

Re: Constantly having to log back in!

by Darren Smith -

Aaaaarrrgggghhhhh sad

I changed my config file to reflect your post and it didn't help. To test it I logged in and then waited for 2 mins and then launched chat but just got the little login window in the chat pop up. If I went into chat straight away it worked fine.

Darren

In reply to Darren Smith

Re: Constantly having to log back in!

by Darren Smith -

I'm still having problems with this.

My $CFG->wwwroot  is fine now (took the www out) but I am still getting the sympoms of being timed out after a couple of mins. My web host is with supanames and they are running linux and say they can't see any problems their end.

Any thoughts?

Thanks

Darren

In reply to Darren Smith

Re: Constantly having to log back in!

by Chris Neaves -

Darren

I have just gone thru the same nightmare u are having with a ISP provider.

With me it turned out to be the internet provider and they moved me to another machine.

Here is a way to prove it,  that worked for me.

First I downloaded a copy of Mozilla as it lets you view and remove the cookies easily, more easily than IE I found.

Now make a folder on your server in the folder that moodle is living in and call it test

Put into this folder this simple little script that I have attached, called php.test

Now using Mozilla with no cookies saved in it open up the script : ie www.icthelp.biz/moodle/test/test.php

You will see that the page opens and says:

  •  Counter initialized, please reload this page to see it increment
The counter is now 0

Now click refresh and the counter changes to:

  •  Waking up session
The counter is now 1

My problem was the server was killing the session in about 50 minnutes, yours may be different. What I did was to leave my mozilla open, not touching it for 60 minutes. I would come back hit refresh and found the session was being killed and had to be restarted in order for the script to continue. I even tried putting in a .htaccess file to override the session time(even though phpinfo showed session time as 4 hours), and it didnt work, it would still get killed in under 60 minutes.

I showed this to the techs at the ISP, they concurred there was a problem and they gave me a new server.

In reply to Chris Neaves

Re: Constantly having to log back in!

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
To make things easier, this script is actually included in all versions of Moodle:

  http://moodle.org/lib/session-test.php
In reply to Martin Dougiamas

Re: Constantly having to log back in!

by Chris Neaves -

Without sounding like a pratt.. I did  actually try this script but it seemed to just tell me the sessions were working, and even after leaving the pagesit idle for 60 minutes I still got the message:

Session found - welcome back!

Sessions are working correctly

Reload this page

So from using this script all I seemed to be able to tell was my sessions were working, hence my mod. I have also had this exact same problem 2 times now on 2 different ISP's, I just signed an account with globat.com, ($7.50 per mth for 2000gb space and 60bg thruput) and out of curiosity put a moodle install on it, and for once I got a no hassle install (although had to put the data directory in the cgi bin to get it to work as I have no root access) .

 

In reply to Chris Neaves

Re: Constantly having to log back in!

by Darren Smith -

Thanks for the help. Using the mod script I get:

Fatal error: Call to undefined function: session_cache_expire() in /home/planetsco/public_html/moodle/test/test.php on line 4

The official script seems to work in the sense it loads and displays 'session found - welcome back'. I will leave it now for a while to see what happens when I reload

Thanks

Darren

In reply to Darren Smith

Re: Constantly having to log back in!

by louis jordan Mr -

Guys,  I am having the exact same problems.

My moodle installation is a default-standard setup.  All the settings are good.  This is the problem.

Whenever any user (including admin) logs in, he automatically has to relog in after a few minutes of use.  I have used IE 6, mozilla firebird, opera, some apple browser, and ie 6 at an internet cafe.  I've accessed the site from the US, and from Romania.  Same stuff.  I assume it is my server, which has other serious issues they refuse to respond to. 

Here is my server info:

http://splashhost.com/hosting.htm starter plan

If there is someone here who knows of a trouble-free server for moodle that has a good price.  Please let me know.  I'm looking at $50 to $100/year and need about 100megs of hd space and at least 2 mysql accounts.  Thanks.  I'd love to try installing this fine script on a server that works to make sure the problem is not coming from my end.  Here is my site btwhttp://www.thedreamschool.com

In reply to louis jordan Mr

Re: Constantly having to log back in!

by Steve H. -

I use P4HOST to host my site. I do have to relogin but it is alot longer than a few minutes. I have never timed it actually but I have it set to time out after 4 hours.

You can visit them at http://www.p4host.com/

I have this package http://www.p4host.com/extraplan.php

As you can see that one more than meets the specs you are looking for.

Hope that helps.