Save changes as admin\ Logging in issue

Save changes as admin\ Logging in issue

by Kyle Goliath -
Number of replies: 8

Good Day 

Firstly I would like to apologise for having two issues in one post. I am not sure if these two issues are caused by the same or one or more faults.

Moodle 3.2.2 (Build: 20170313) , MySQL 5.6.37, PHP Version 5.6.31, Apache Version 2.4.27, OS - Linux. I have another instance of moodle running on this server and has its own database, folder structure and edited config.php.

I am having problems saving changes made to settings within Site Administration. I am the main admin but whenever I make changes, for instance, changing a colour within the theme or changing my SMTP configuration and I click the "save changes" button, the changes do not take effect.

I am completely stumped. I am also struggling with a "your session has timed out" problem when logging in. I have cleared the sessions table in the database for both instances of moodle. 

I am however able to gain access to the site by logging in, moodle then sends me back to the front page then I have click "log in" for a second time which brings me to a "you are already logged in" screen where I am able to select the dashboard or course.

I am unsure if these two issues are related or if it's because I have two instances running on the same server. 

I do want to post images but I'm not exactly sure which screenshots would be most helpful.

Thank you in advance.

Kyle Goliath


Average of ratings: -
In reply to Kyle Goliath

Re: Save changes as admin\ Logging in issue

by Ken Task -
Picture of Particularly helpful Moodlers

By chance are the two instances on same server in a different sub-directory (same FQDN)?

Are you using the same browser to login to admin of both instances?

Might have a cookie conflict.  Clear cookies of browser.   Login o Moodle A and set cookie prefix to MA.

Log out.

Login to Moodle B and set cookie prefix to MB.

See Session Handling config of both servers.   Using DB for sessions or files?

'spirit of sharing', Ken

In reply to Ken Task

Re: Save changes as admin\ Logging in issue

by Kyle Goliath -

Good Day Ken

Thank you for your response.

1. The two instances are in sub-dirs on one domain

2. I have used the same browser to access both instances. 

3. The sessions are saved to files. 

If the sessions are saved to file, will clearing the sessions data in the DB have any effect on operations? If not, should I clear out the sessions data in the Moodle folder on the server?

Is it better to have sessions data saved to the DB rather than files?

Also just to add to the login issue, sometimes when I or other participants access our site, we get logged into somebody else's profile. Is this "normal" when having log in issues?

I will make the suggested changes and let you know if the issue is resolved.

Thank you Ken

Regards, Kyle

In reply to Kyle Goliath

Re: Save changes as admin\ Logging in issue

by Ken Task -
Picture of Particularly helpful Moodlers

Sessions are files in the newer versions of Moodle by default.   If you think about it a minute, the DB for a Moodle takes tons of hits.   During a session with Moodle, sessions are checked and in the case of an admin user session information changes ... as in the case of 'login as' while an admin.

To take some of the load off the DB, use files.

When you make a change to sessions ... DB / files, it takes place immediately.   There is a task in cron jobs now that cleans up session info ... and for that to keep things working, cron has to run more frequently ... have seen recommendations that cron be scheduled to run every minute now.

So that would be another recommendation I would make ... run cron more frequently if not set to every minute right now.

If you check your browser cookies for Moodles think you'll see there is a cookie for session.   So the business of a user logging on and finding them in another users account could be workstation and cookie related.   User A sits at workstation B ... doesn't log out of Moodle properly.   Cookie in the browser still remains unless browser is set to remove cookies on close.   User B comes along and uses same workstation.   Goes to Moodle and finds themselves in the former user's (user A) account - nor forced to login cause cookie is still present in browser.

As an admin level user, I sometimes use different browsers when working on multiple moodles on same server at the same time.   Moodle A - FireFox.   Moodle B - Safari (yep, I use a Mac).   Browsers don't share cookies.

'spriit of sharing', Ken

In reply to Ken Task

Re: Save changes as admin\ Logging in issue

by Kyle Goliath -

Good Day Ken

Apologies for the delayed response.

I've been having the worst time with this. I cleared cookies and cache on both my browsers, Chrome & FireFox, logged in and tried to change the cookie prefix for both instances of Moodle but because of the issues I've been having, when I click the "save changes" button, I do not see changes immediately.  I'm not sure if those changes have taken effect but something has gone wrong as I am not able to log in anymore. When I try log in it only gives me access to the guest account. I can see that my profile is logged in as it shows in the "Online Users" block but when I try access my profile it tells me that I am not allowed to access because I'm logged in as Guest. This sends me back to the front page and the cycle replays itself. 

Also when last I saw, Monday 25 Sep, the crons job, on notifications page, says it has not run for at least 24 hours. Does it usually say that? and how do I ensure that it is always up to date.

I'm really at wit's end but not giving up though. 

Regards, Kyle

   

In reply to Kyle Goliath

Re: Save changes as admin\ Logging in issue

by Ken Task -
Picture of Particularly helpful Moodlers

Both moodles should have their own separate cron jobs and cron should now be run more frequently than 24 hours ... have seen recommendations it be run every minute now, by some.

One sets up cron outside of Moodle.   System is linux so that normally means crontab.

With whatever you have (control panel - cPanel or whatever) check crontab settings.

IF you had crons set to run via the web interface with a password one could access running the cron job via browser:

    http://site.example.com/admin/cron.php?password=opensesame

If you set it that way, try that with a browser.    Run it more than once.

Also, do you have more than one account that is set to admin level?    IF so, use it to see if you get the same behavior.

'spirit of sharing', Ken

In reply to Kyle Goliath

Re: Save changes as admin\ Logging in issue

by Ken Task -
Picture of Particularly helpful Moodlers

A follow up to 'not sure if changes to session cookie changes have taken affect' ...

If you can edit your config.php file, one can set that cookie via editing the config.php file and entering a value.     So for Moodle A, as an example, edit config.php and add the following line:

$CFG->sessioncookie='MDLA';

Be sure to be careful about the formatting of that line ... case sensitive, 'ticks' enclosing values, and a closing 'semi-colon' at the end of the line.

For the other Moodle instance do the same only make it 'MDLB'.

Changes/additions made to config.php like this do NOT require restart of any services and should take affect upon the next attempt to login via browser.

Also, if you have command line access to your server, one can run the cron jobs via command line.

cd /path/to/moodlecode/admin/cli/

then

php cron.php

If cron hasn't been run in a while, there's lots to clean up so that might take a while until you get more frequent settings in crontab.    This to say you might have to run that last command more than once until you see no more task/jobs need running.

'spriit of sharing', Ken

In reply to Ken Task

Re: Save changes as admin\ Logging in issue

by Kyle Goliath -

Good day Ken

Hope you are well?


Just wanted to give an update on the current status of my LMS. I owe it to you.


Both the Moodle instances are functioning at 95% (little hiccup with bulk messaging) but as far as the log ins, cron jobs and cookies settings they are all fine now. Actually the cron jobs were set up incorrectly, they weren't  linked to the correct moodledata folder. 


Thank you for all the help Ken and apologies for the very late reply.


If you want more info from please feel free to message me or I can message you.


Cheers and Thanks again Ken

In reply to Kyle Goliath

Re: Save changes as admin\ Logging in issue

by Ken Task -
Picture of Particularly helpful Moodlers

Welcome.   Glad to hear it's resolved.

'spirit of sharing', Ken