Cookie error for all users after upgrading to 1.8.4+ URGENT

Cookie error for all users after upgrading to 1.8.4+ URGENT

by Richard Williamson -
Number of replies: 22
Hi all,
I've just upgraded to 1.8.4+ from 1.8.3. Now, no users can log on as they get "Unfortunately, cookies are currently not enabled in your browser". The exception to this seems to be me, where I enter my password, click on login, and then my password just disappears and I am left at the login screen with no error. The error is the same in Firefox and IE. We have tried switching off firewalls and privacy settings, to no avail.

During upgrade, there were no errors. I was logged on during and after the upgrade, and I was only affected after I logged out, then back in again.

I've tried clearing the sessions folder in Moodledata.
I've tried rebooting the server.

Any thoughts would be most welcome, as no users have access.

TIA
Richard
Average of ratings: -
In reply to Richard Williamson

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Mauno Korpelainen -

http://docs.moodle.org/en/Upgrading_to_Moodle_1.8#Multi_Authentication

It is probably authentication problem and if you have access to database (phpmyadmin) try sql

update mdl_user set auth='manual' where auth='none';

or check if some other authentication method works for you.

If that does not help check permissions of moodledata/sessions folder...

In reply to Mauno Korpelainen

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Richard Williamson -
Thanks for the suggestion Mauno.
I've checked the auth types, and they're all set to manual.
The sessions folder and moodledata folder are set to 0770 with Apache being the owner.

What I find odd is that this happened after the upgrade to 1.8.4+

Regards
Richard
In reply to Richard Williamson

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Mauno Korpelainen -

But the good news is that you are not the first one to have this problem...wink

Try next to check/change in table mdl_config

mnet_localhost_id to 1
dbsessions to 1

Did you change anything during upgrade (paths, config.php, server settings, lib files ?)

Sometimes wrong server time gives the same error, sometimes it comes from config.php...or some edited lib file (with "wrong" text editor)

If nothing else helps try

cookieless sessions http://docs.moodle.org/en/Cookieless_Sessions

Add

$CFG->usesid=true;

to your config.php

In reply to Mauno Korpelainen

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Richard Williamson -
I have changed
mnet_localhost_id to 1 (it was already 1)
dbsessions to 1 (was 0)

Still no change.

I tried adding $CFG->usesid=true; into config.php. this works to a certain extent, but requires a logon each time a new page is accessed.

When I upgraded, I made no changes to config.php or anything else.

I'm now getting moderately concerned, as it will be used in school in 8 hours :o

Regards
Richard
In reply to Richard Williamson

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Richard Williamson -
As an update to this, I have just checked on other Moodle installations on the same server, and they all work.

I have just upgraded one of those to 1.8.4+, and that works just fine.

To me, this is pointing to something in the moodle database or setup.

Any more advice would be most welcome, and would probably result in me getting some sleep tonight.

Regards
Richard
In reply to Richard Williamson

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Mauno Korpelainen -

Well it's a good sign that your other moodle works ok. I tried to find from your previous posts anything special and saw one ModSecurity case and some problems with backup. The problem might be this ModSecurity (if it still is on) or some other security thing that prevents use of session cookies. Otherwise dbsessions should work.

Take away

$CFG->usesid=true;

from config.php and try what happens if you go to http://yourserver/moodle/lib/session-test.php

Have you tried to repair tables with phpmyadmin?

Edit: or some file is missing - uploading all files again might help.

If you turn debugging to all or set to mdl_config

debugdisplay to 1
debug to 2047

or to config.php

$CFG->debugdisplay=1;
$CFG->debug=2047;

you should get some error messages anyway...

In reply to Mauno Korpelainen

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Richard Williamson -
Hi Mauno,
thanks for your time on this one.

When I got to http://yourserver/moodle/lib/session-test.php I get "No session found - starting a session now." I reload the page, and I get: "

Session found - welcome back!

Sessions are working correctly"

I've turned debugging on, and get no messages at all.
I've tried re-uploading all the Moodle files.
I've tried repairing the database, but all the tables were ok.

ModSecurity may be the problem with the constant loggin on with cookieless session. When I check the Apache logs, I see many repeats of:

[Sun Jan 20 22:35:31 2008] [error] [client 82.4.153.253] PHP Notice: Trying to get property of non-object in /var/www/html/moodle/lib/cookieless.php on line 71, referer: http://linuxweb1.garibaldi.notts.sch.uk/moodle/login/index.php?MoodleSessionmain=clattc6iqern04pb30mbmaa9p7
[Sun Jan 20 22:35:31 2008] [error] [client 82.4.153.253] PHP Warning: stripos() [<a href='function.stripos'>function.stripos</a>]: needle is not a string or an integer. in /var/www/html/moodle/lib/cookieless.php on line 71, referer: http://linuxweb1.garibaldi.notts.sch.uk/moodle/login/index.php?MoodleSessionmain=clattc6iqern04pb30mbmaa9p7
I've got no idea what the stripos() function does, but could this be to blame?

Is it worth me upgrading to 1.8.9 to see if that cures it?

Heeeeeeeeelllppp
Richard


In reply to Richard Williamson

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Mauno Korpelainen -
Sorry - I have no idea right now...
In reply to Richard Williamson

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Richard Williamson -
As an update to this, after having turned all debugging on, I get the following error on pages within a certain course
Warning: include(ui/chameleon.php) [function.include]: failed to open stream: No such file or directory in /var/www/html/moodle/theme/DiDA/header.html9

Warning: include() [function.include]: Failed opening 'ui/chameleon.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/moodle/theme/DiDA/header.html on line 9
on line
This is also the case in other courses which use the Chameleon theme.

Also, there are no images any more, and the HTML editor is not working.

I'm beginning to think that the stripos() function is stripping more than it should do - although I'm clutching at straws here.

Any help would be more than welcome, as this needs to be working in 1.5 hours :o

TIA
Richard
In reply to Richard Williamson

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Mauno Korpelainen -

Can you switch to standard theme? Is this theme DiDa some custom theme of yours - in source code theme is garaSTANDARD

Without administration menu you may change it from database table mdl_config:

allowuserthemes to 0
allowcoursethemes to 0
theme to standard

In reply to Richard Williamson

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Mauno Korpelainen -

This is really strange: theme/DiDA/header.html9

Missing theme?

In reply to Mauno Korpelainen

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Richard Williamson -
Not missing. I've checked, and the files are definitely there. It's also doing this on other courses which use images in their header.

New development: I've tried restoring the database from before the update, but the result is the same, pointing to a problem somewhere in the Moodledata folder - sessions maybe? I'm stumped.

In reply to Richard Williamson

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Mauno Korpelainen -
Also 'ui/chameleon.php'  inside DiDA theme? (the error)
In reply to Mauno Korpelainen

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Richard Williamson -
AFAIK, that is just the php script which is calling the file. I don't think it's insinuating that it's in that folder. Does this sound reasonable?
In reply to Richard Williamson

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Mauno Korpelainen -

If you have double checked permissions check once more settings from Administration -> Server -> Session Handling

Try to change cookie prefix, cookie path (create new folder for sessions) and uncheck dbsessions

In reply to Mauno Korpelainen

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Richard Williamson -
OK, I'll give that a shot.

What I've now managed to do is restore the database and moodle files from before the problem. All seems to be ok, but is it safe to use? I assume it will be if the upgrade to 1.8.4 from 1.8.3 didn't make any changes to the structure of the moodledata directory.

Since restoring it to this version, I have tried upgrading to 1.8.4 again, but I get the same problem. If I try upgrading to 1.9, I get a session error and it won't let me proceed.
In reply to Richard Williamson

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Siegmund Langsch -
Hello,

I've had the same problems with cookies. I've spent just Hours to figure out whats wrong. So, here is *my* solution:

It ist not "really" a cookie problem. It is a problem with moodles $testcookie function. Cookies are all present in your Browser, but moodle "thinks" that yu have disabled them. Go to /login/index.php

Open it with the editor of your choice.
Go to the line that sounds like that:
$testcookies = optional_param('testcookies', 0, PARAM_BOOL); // request cookie test

Comment it out with two slashes //

All will be fine with login now.

Bye
Siggi
(sorry about my english, i am not probed often to use english language)
(to developers: someone should check this function)


In reply to Siegmund Langsch

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Mauno Korpelainen -

Siegmund,

if you comment that line then $testcookies has no value and the actual test (some rows lower)

if (empty($CFG->usesid) and $testcookies and (get_moodle_cookie() == '')) {    // Login without cookie when test requested 
          $errormsg = get_string("cookiesnotenabled");
 
      } else ...

definitely fails and you will never get message "cookiesnotenabled". However it does not explain the reason for the error - it just removes the message itself. All error messages may have various and sometimes very unexpected reasons but all those test functions are necessary.

In reply to Mauno Korpelainen

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Siegmund Langsch -
Hi,

that's clear. But there is *nothing* wrong with cookies and moodle tells me always that cookies are not enabled. So NO login is possible. The session-test results proper and all cookies are stored in Browser. There must be definitly something wrong with this funktion in some situations. It does'nt matter that I will now never a get cookie warning. There is a text present with a hint that cookies have to be enabled. That must be enough in my situation. I'v read several Forums, read xxx Docs and searched google abaut hours, but ther is no one who has another solution for me.

Bye
Siggi
In reply to Siegmund Langsch

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Siegmund Langsch -
Addition:

I've just figured out for me where *my* problem is coming from.

The Server I am using runs several Virtual Hosts with one (shared) IP. So when I switch (in apache.conf) CanonicleNames to "dns", the problem with cookies disappear. So it is no Problem with moodle, it was a problem with server.


In reply to Siegmund Langsch

Re: Cookie error for all users after upgrading to 1.8.4+ URGENT

by Markus Graw -
Hallo Richard,

I had the same problems after an update from 1.8.3 to 1.8.4. A "cookie-login problem".
I got the first important informations from the degugging-mode (Administration-Server-Debugging). It reports me an error with my de_utf8 language package, which I downloaded from the Moode-Site. From my Backup I rebuild the old package to //moodledata/lang/de_utf8 and all problems were gone.

Maybe this will help you too.

Regards
Markus