A server error that affects your login session was detected

A server error that affects your login session was detected

by Rory Braddell -
Number of replies: 16

Dear Sirs,

I have successfully run the installation script of moodle However, I still have a PROBLEM. After getting to stage “creating an admin password” and I was actually logged in after, but then when I wanted to go further, I got a blank screen with the error “A server error that affects your login session was detected. Please login again or restart your browser (Continue ).” I clicked “continue” and tried to login but I was not able to log in because I got the “A server error ...” message again. I tried these steps six times creating different passwords, I tried different browser and I adjusted my browser settings. Is it worthwhile to complete the entire installation again? Or is the problem going to persist? I cannot login in as a administrator and use moodle. I have really tried hard to solve several problems installing moodle over the last few days so this is a bit of a dissapointment for me as neither I nor my webhost are to solve it.

This seems like a difficult problem to find the cause of.

Thanks for all your help

Rory Braddell

Average of ratings: -
In reply to Rory Braddell

Re: A server error that affects your login session was detected

by Rory Braddell -
Thanks for your reply to my Question? I was able to fix the login problem by asking my web host to switch it to a database driven session management, and then I was able to login as an administrator. I still have problems with my installation though, as now I cannot access or upload an files and I am get an error message:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

___

What is the problem with my configuration? I have put info below

Could this be a problem with the data root:


$CFG->wwwroot   = 'http://www.englishexpert.de/llms';
$CFG->dirroot   = '/var/www/web335/html/llms';
$CFG->dataroot  = '../../files/';
$CFG->admin     = 'admin';

System  Linux webbox122 2.6.18 #2 SMP Mon Feb 25 17:41:08 CET 2008 i686 
Build Date  Dec 1 2008 17:16:27 

Moodle 1.9.3+ (Build: 20081224)

Regards,

Rory Braddell

In reply to Rory Braddell

Re: A server error that affects your login session was detected

by Mauno Korpelainen -

Rory,

read first http://docs.moodle.org/en/Installing_Moodle#Software

MySQL version  4.1.11 sounds low...

In your php settings

- safe_mode needs to be OFF
- magic_quotes_gpc should be ON

disable_functions system,passthru,shellexec,popen,escapshellcmd,proc_open system,passthru,shellexec,popen,escapshellcmd,proc_open may cause trouble

and finally $CFG->dataroot  = '../../files/';

should be something like

$CFG->dataroot  = '/var/www/web335/files';

In reply to Mauno Korpelainen

Re: A server error that affects your login session was detected

by Rory Braddell -

Hi Mauno,

I have altered the config.php by overwriting the one in the main directory. it now reads the correct path:

$CFG->dataroot = '/var/www/web335/files';

The other setting like "safe_mode" and "magic_quotes_gpc" are correct from the beginning. The other functions that you mention, I cannot alter or check, as my installation is hosted remotely with a hosting company, and I do not have administrator access to the server. I have informed them of my problem.

Obviously they do not have the most recent versions of PHP or MYSQL, but I thought that it would still be possible.

The present condition is that I can use moodle but I cannot access the "files" section, so it would not be useful for me.

As I am an English teacher and not that good at Computers and PHP scripts, I am about to give up, but I will wait to see what my web host says about it in the next few days,

The only problem that I can think of is that it may be caused by the dataroot files folder ownership settings, but I am not sure. The root file owner is the same as my user name on the webhost. I had a problem with session managment that my host switched to database session management, so I think that it is a dataroot file problem. I hope that my host can help me regarding this, but the ideas that were given here have not solved this problem as of yet.

Thanks for your help,

Rory

In reply to Rory Braddell

Re: A server error that affects your login session was detected

by Richard Enison -
RB,

  1. You don't have to "think that it would still be possible" when the Moodle installation doc page tells you exactly what the requirements are. You don't need the latest version of MySQL, for example, but you do need at least 4.1.12 (4.1.16 if you use other languages than English). So 4.1.11 is not enough. And MK gave you a link to that page.
  2. I'm sure that he meant it to be an example of what a valid file pathname looks like when he suggested /var/www/web335/files instead of ../../files. It doesn't mean you have to use exactly that pathname for dataroot. That's why he said "something like ..." Does that directory even exist? I mean, is there actually one called files in the subdirectory web335 of /var/www, and does it have the right permissions, etc.? Is that the one you intended to use for your data files? I can see why he would use that example, considering the pathname you used for dirroot, and from that directory ../../files would take you there, if it existed. So maybe that is what you intended. You're the world's expert on that question.
  3. What did you ask the webhost to do? Upgrade the MySQL? That's not likely to happen. But we'll see.
  4. EDIT: I just noticed. You say the safe_mode setting was correct from the beginning? Not according to your attachment, which says

    safe_mode On On

    I was going to say with all the functions they have disabled, they are so paranoid about security I was surprised they would allow you to run with safe_mode off. Well they're not. And neither is magic_quotes_gpc the correct value, as MK points out.
RLE
In reply to Richard Enison

Re: A server error that affects your login session was detected

by Rory Braddell -

Hi Richard,

The settings are ok as I ran the info.php just now: http://www.englishexpert.de/info.php

and the following settings mentioned by Mauno are ok at the moment:

- safe_mode needs to be OFF
- magic_quotes_gpc should be ON

My moodle installation is installed at:

http://www.englishexpert.de/llms

I have a directory outside of the html folder that moodle should be able to use called "files" and it is in the web335 folder with permissions 777. The owner is the same as the html folder.

There are four folders in this "files" folder called: cache, lang, sessions, temp and a htaaccess file.

As the rest of moodle is working and I am only getting the error message when I try to access the files section in admin, I think that this is a dataroot problem. I do not have any problems with my webhost: www.speicherhosting.de and they seem very helpful regarding the safemode settings and also changing the MYSQL so that I had index rights to create the database. I have asked them to check the error message for me and see if there is a server problem, especially regarding the dataroot folder. They already fixed the session handling problem and switched it to databasesession handling, which I could not do because I was not able to login to admin. This is way beyond the normal support that they offer.

Regards,

Rory

In reply to Rory Braddell

Re: A server error that affects your login session was detected

by Richard Enison -
RB,

OK. You have changed your phpinfo file completely, so now, yes, the safe_mode and magic_quotes_gpc settings are correct. It's still showing 4.1.11 for the MySQL version, but we'll see if they upgrade that.

At this point the main problem is, as you say, the data folder. Eventually, for security's sake, you might want to reduce the permission for the files folder, but let's worry about that after we get it working. Normally, there would be other subfolders besides the four you named, such as upgradelogs, user, and some with numerical names, one for each course that has data files. The numerical names are the id's of those courses. The subfolder user should have a subfolder named 0, with a subfolder for each user with an id less than 1000. Those subfolders would also have numerical names, namely, the user id's. If there are more than 999 users, the ones with id's between 1000 and 1999 would be subfolders of user/1, and so on. These folders are needed for the users' icons, as shown in their profile pages and forum posts. I can only think that these folders are missing because you had the wrong value for dataroot in config.php when you installed Moodle. You might try to find folders with these names elsewhere in your file system and move them under the files folder.

RLE
In reply to Richard Enison

Re: A server error that affects your login session was detected

by Rory Braddell -

Hi,

After reading your email I took the following steps. I deleted the config, so that it would force a new config.php to be generated and I could change the dataroot that way. I added a new dataroot as:


$CFG->dataroot  = '/var/www/web335/files/moodledata';

This was accepted by the new installation (I did not generate a new database as the old one is ok), and everything else seems to be in order, but when I log in I cannot access the "files" section of moodle so I have no content to work with, and I cannot get any further with it. I investigated the my files/moodledata folder (permissions 755) and there are none of the folders that you mentioned in your message, so I doubt if the framework has been created by moodle to save and access things at a dataroot folder.

If I tried to install an earlier version would that work. I have run out of ideas.

Thanks everyone for your help.

Rory

In reply to Rory Braddell

Re: A server error that affects your login session was detected

by Rory Braddell -

Hi,

I have solved my problem by installing an earlier version Moodle-weekly-16. The installation was very smooth and it seems to work ok.

The problem was caused by problem created by my installation of Moodle 19, which was probably caused by the root folder data being incomplete, and the main user data being stored in webserver environment.

I think that I will work with 16 now, as it seems to be ok, and I think that my webhost is using versions of PHP and MYSQL that might be too old for newer versions.

What should the permissions of the dataroot folder (moodledata) be? Mine is currently 777, and I think that these is probably a security risk.

Regards,

Rory

In reply to Rory Braddell

Re: A server error that affects your login session was detected

by Richard Enison -
RB,

You threw the baby out with the bathwater (by replacing Moodle 1.9.x with 1.6) before I had a chance to say, I wouldn't worry too much about those subdirectories being missing. They are probably created as they are needed, such as when you try to upload a file to a particular course.

Now that you are using 1.6, you say everything is okay. Does that mean those subdirectories are no longer missing? I very much doubt that user is there, because Moodle 1.6 didn't use user, it used users. The difference is that the individual subdirectories for the users are subdirectories of users directly, not of subdirectories named 0, 1, etc. of users, one for each 1,000 users as with the user directory in 1.9. The two-tier system was created to enable the handling many users on systems that limit the number of subdirectories a directory may have.

As for the permissions question, I agree 777 is too high, although the most important thing is that the data folder be outside the web-accessible root, and yours is. For info on this security issue, see Installing_Moodle#Creating_the_data_directory and Security#Most_secure.2Fparanoid_file_permissions.

RLE
In reply to Richard Enison

Re: A server error that affects your login session was detected

by Rory Braddell -

Hi Richard,

The question is, if my system runs 1.6, can it run 1.9 without having to update things like MYSQL and PHP? If that is so, then I can install 1.9 again in about one hour.

I am not really clear about the differences yet. 1.6 definately gave me a few more options during the installation, and I did not really have the problem of session management anymore like I did at the beginning of the first installation, so I did not need to switch to dbsession management.

I think my problem was the use of the .relative root: ../../files, which created these rootfiles in the wrong place. When I installed with 1.6 I created another directory called "moodlefiles", which is in the "files" folder outside my public_html directory. The path for this folder was complete this time (NOT RELATIVE) and it worked. The first time I did this trying to intstall 1.9, I got a message saying that it was not possible to create a folder and then I put in the relative address and it seemed ok. This seemed a bad idea in the end as the rootfile contect was definately in the wrong place then, and it failed to work properly when I attempted it put it back together again.

If you think it would work with 1.9, I will try to install again then it might be worth it. I am new to moodle so I have a lot to learn,

Thanks,

Rory

In reply to Rory Braddell

Re: A server error that affects your login session was detected

by Richard Enison -
RB,

According to Installing Moodle#Software, Moodle 1.6 and 1.9 support the same versions of PHP and MySQL, although you might need more PHP extensions with 1.9, depending on the features you use. However, I wouldn't go back to 1.9 until and unless I was prepared to find out why you got the msg. about how it was not possible to create a folder (probably the data folder; if so, see http://moodle.org/mod/forum/discuss.php?d=84369#p372906). The reason you were having problems with a relative dataroot path might be that it would look for data files in a different place depending on where it (the current script) was.

There are lots of differences between 1.6 and 1.9. For example, 1.9 (and 1.8) requires the character set of the database to be UTF-8, a Unicode encoding. This makes it possible to have text in different languages on the same page. Moodle 1.6 is the first version that allows UTF-8, and it, along with 1.7, has a database migration script that allows you to convert a non-Unicode database to Unicode. Since 1.8 and higher require Unicode compliance, they do not have that feature.

Another difference is that 1.6 does not support user-defined roles. These were introduced in 1.7, but in a way that is not upward-compatible. This is one reason why it is recommended, when upgrading from 1.6 (or lower) to 1.9, that you go one major version at a time except that 1.7 be skipped.

For more on version differences, see Latest release notes. For info on upgrading to different versions, see Upgrading to Moodle 1.8 and Upgrading to Moodle 1.9.

RLE
In reply to Richard Enison

Re: A server error that affects your login session was detected

by Jaswant Tak -
So Guys,

anybody got the solution or still its a mystery?

jassy
In reply to Rory Braddell

Re: A server error that affects your login session was detected

by Teddy LINET -
I've installed joomla yesterday... and had the same error message. And I've thought that I was cursed.

My dataroot was unfortunately in the root dir (in my case : www/www).
$CFG->dirroot = '/';
$CFG->dataroot = 'www';

I've changed the name to "dataroot" and the location outside the dirroot...
$CFG->dirroot = '/';
$CFG->dataroot = '../dataroot/';

And almost everything works now... I've sometimes "Module "dataroot" is not readable sometimes" even if its 777...
In reply to Teddy LINET

Re: A server error that affects your login session was detected

by Teddy LINET -
Self reply (now everything works).
I didn't want to have a http://mysite.com/moodle, so I've copied all the files at the root and not in a moodle folder. The idea was to type only mysite.com...
Installation works... but not moodle with session problems and so on.
That was not a good idea...
Moodle wants its folder, so I give it. And now I'm happy !
In reply to Teddy LINET

Re: A server error that affects your login session was detected

by Gary Benner -

Teddy,

If you want the URL to be http://mysite.com without the trailing "/moodle" then you need to reconfigure your webserver's "DocumentRoot" ( that's what Apache calls it - in IIS it is called the the "Local Path" in the "Home Directory" tab ) to point to the physical location on disk ie. the folder where the Moodle files are.

For convenience we usually have them inside a folder called "moodle", as when you unzip or untar the files supplied, they come inside a folder called "moodle".

However the URL does not need that.

kind regards

Gary