Cookie problem stoping log in after 1.5 upgrade

Cookie problem stoping log in after 1.5 upgrade

by Greg Sharp -
Number of replies: 10
I first tried installing a 1.4.5+ version a few months ago. The install showed no errors but at the top of each page I could see code relating to cookie info (strange thing was some items mentioned related to other sites/domains I ran on the same server machine). Apart from this visual bug components appeared to work okay. I decided to wait and see if the next upgrade would fix it.

I just upgraded to 1.5 official release. The majority of upgrade gave success messages however I noted 1 or 2 table errors (sorry didn't make a note of which ones). I tried repeating the upgrade and again got 1 or 2 errors (different table errors this time which was strange) though otherwise all went well. I tried a 3rd time but nothing happened and I was redirected to login page instead.

However now I can't log in (basic) as admin or guest and get error my browser doesn't support cookies. I've had the same error in Firefox, Safari & Explorer. All browsers show the same original cookie errors info at top of page. I've run Moodles session checking page and all appears fine. Yet when I check in Firefoxes  cookie preferences instead of finding 3 moodle cookies I find only 2, moodleID isn't being created. I also get errors about moodles style sheets being defined as the wrong type eg text not css, however this may be unrelated.

I'm running on a Dual G4 Mac, OS 10.3.9, WebStar V 5.4 Server, Lasso 7.03, PHP: 4.3.10 and MySQL: 4.0.21 Complete MySQL by Server Logistics on this box with 1.5 GB RAM.

I run multiple Mambo, PHPBB2, PHPCalendar and other PHP based scripts on multiple virtual domains/subdomains and none of the other programs working with sessions/cookies have any problems. Luckily this is a test site with no other members and no courses yet.

Has anyone got any ideas how to fix this or have opinions on trying a fresh install with a new database? Also I'm in the process of adding an XServe to our network which will run Apache and FileMaker Server 7 Advanced. Would moodle perhaps work better with Apache than Webstar V? Any opinions?

Examples of the errors showing on page follow
On first loading page "Expires: Accept-Ranges: none" shows
I click on log in link and login page shows same message and the following text in the middle of the page
Login here using your username and password:
(Cookies must be enabled in your browser) Cookies must be enabled in your browser:left; clear:left; } #calendar .maincalendar .eventlist .event .date { float:right; } #calendar .maincalendar .eventlist .event .description .commands { width:100%; } #calendar .maincalendar .eventlist .event .description { padding:5px; } #calendar .maincalendar .eventlist .event .picture { padding:8px; } #calendar .maincalendar .eventlist .event .side { width:32px; } #calendar #selecteventty

When I fill in admin user name and password and submit I get the same page returned but now the middle of page says
(Cookies must be enabled in your browser) Cookies must be enabled in your browser
Unfortunately, cookies are currently not enabled in your browser

At the top of page is the following error showing
Expires: Accept-Ranges: none 3 GMT; path=/ Content-type: text/html; charset=iso-8859-1e-check=0, post-check=0, max-age=0 Expires: 0 Pragma: no-cache

Every time I repeat process the messages change. Very strange.
Average of ratings: -
In reply to Greg Sharp

Re: Cookie problem stoping log in after 1.5 upgrade

by Penny Leach -
First of all, it's really important to make a note of the errors during upgrade. Do you have access to your mysql or postgres log? And the apache log? Can you go through it for errors and post them here?

Second, it's normal for the errors to be different the next time round as Moodle will think it hasn't upgraded successfully if some of the tables failed, and will try and create all tables again, including the ones that succeeded the first time. That will result in an error about the table already existing.

As for the cookie /header problems, it looks like something is being outputted to the browser before the headers maybe? Can you give us a URL to look at?
In reply to Penny Leach

Re: Cookie problem stoping log in after 1.5 upgrade

by Greg Sharp -
Hi Penny

I ended up deleting my moodle databases last night and doing a fresh install of version 1.5. The fresh install didn't show a single error. At the end I was redirected to the moodle index page and was logged in as admin. I even entered a news item. Everything looked fine except for the strange injection of code at the top of the page as mentioned earlier. One bit of text that appeared on one page was from a completely different domain I host.

Today when I went back and tried logging in to moodle I couldn't. Neither as admin or guest. Message appearing on page is my browser doesn't support sessions. Just like my original problem, so it is a 1.5 problem/bug because I had no trouble with the previous version. Moodle is the only PHP based script having problems with sessions, all my other scripts work great.

If you want to look at the site and see if it gives you any clues here's the address.
http://www.australian.macusersgroup.org/moodle/
In reply to Greg Sharp

Re: Cookie problem stoping log in after 1.5 upgrade

by Penny Leach -
Ok -- I would hazard a guess that whatever it is that's appearing before the tag is breaking it. Moodle sends a cookie and if it can't see it on the next request, assumes you don't have cookies enabled. Since some weird output is happening before the beginning of the tag I'm guessing the cookie is failing to be sent because the response has already been committed.

You say, "One bit of text that appeared on one page was from a completely different domain I host" -- you don't have something in a .htaccess file or apache conf that's doing php auto_prepend or anything?

moodle.org is running 1.5 and we're not seeing the same problem here - you can log in fine here obviously as you're posting.

In reply to Penny Leach

Re: Cookie problem stoping log in after 1.5 upgrade

by David Field -
I'm not sure it will help everyone.. However I had EXACTLY the same problem on a WinXP XAMPP platform pc after a 1.5+ upgrade, and scratched my head because of all these cookie problems, i rebooted more than my fair share of times, i then had a problem with some software called Brim, and resolved it by turning off ZoneAlarm 5.x, while zone alarm was off i load up Moodle, and it worked first time.

It's not a general firewall problem, because i still have McAfee Firewall running, i think its the way i have zone alarm configured to handle cookies?

So try turing off the firewall on the client (if you have one), and see if it works, i am going to see which setting in Zone Alarm causes the problem. And will post any findings...
In reply to David Field

Re: Cookie problem stoping log in after 1.5 upgrade

by Greg Sharp -
Hi David

I have a Netgear Router with its inbuilt SPI/Firewall connected to my cable modem. However the client machine I'm accessing my site from is on the same subnet as the server & hasn't got any active firewall turned on. Cookies work for everywhere else including this site, all my other sites just not my moodle site. I can't see a firewall as being an issue in my case.
In reply to Greg Sharp

Re: Cookie problem stoping log in after 1.5 upgrade

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
There is a great many of changes in Moodle 1.5. AFAIK it was tested with Apache and IIS. If you find solution to your problem, please post it here so that we can fix it in CVS.
In reply to Petr Skoda

Re: Cookie problem stoping log in after 1.5 upgrade

by Greg Sharp -
I've done a search on the Forums for "Webstar". Although not having the same problem every Webstar user reports problems viewing content after uploading files to the moodledata folder and this goes back for years. The only answer suggested by all is to change to an Apache server.

I've just bought an XServe & XServe Raid which I'm setting up to work with Filemaker Server 7 Advanced (requires Apache to be installed). When finished I'll try moving the site over to Apache and see if that helps. I will post this problem to the Webstar lists and perhaps find out if the bug is with Webstar or not.

My only other choice would be to reinvent the wheel and develop my own solution, but to be honest I'm feeling lazy so Apache seems to be the go.
In reply to David Field

Re: Cookie problem stoping log in after 1.5 upgrade

by Keith Peden -

Hi David,

I had exactly the same problem.  It was my ZoneAlarm firewall.  I can log into other Moodle sites just fine, but not our own.  In ZA, I had to shut off "Remove private header information" under "3rd party cookies" under "Cookie Control - Custom".  It worked great after that.  I had even set my IE cookie control to High.  However, since I can operate with that setting on for all other sites I go to, there is something unique about my machine and our Moodle site.  My colleagues can (of course) log into our Moodle site just fine.

Anyone have any thoughts on this?

Thanks - Keith

In reply to Keith Peden

Re: Cookie problem stoping log in after 1.5 upgrade

by Jim Hardy -
I also get the same problem about not being able to login (claiming my browser can't accept cookies - and have a webstar server.

The error message is:

PHP Warning: Cannot modify header information - headers already sent by (output started at /login/index.php:24) in /lib/moodlelib.php on line 2130

The line 2130 alternates with line 2131.
In reply to Penny Leach

Re: Cookie problem stoping log in after 1.5 upgrade

by Greg Sharp -
Hi Penny

I'm not running Apache, I'm running WebStar V by 4D. It doesn't use a .htaccess file for permissions. It's installer has a custom option that you run to repair permissions when there's problems. Custom realms are set up from its  Admin app but this site isn't using any custom realms.

I looked in the moodledata folder and directories for sessions and other functions are being created within this folder but the permissions on these files are mixed. The session folder and contents have  the "webstar" user listed as owner as it should be however  group & others show no access. When I checked the  admin picture I uploaded in the admin profile during initial install & setup both the picture  and the thumbnail show as owner "greg", group & other no access.

To read files my server needs owner to be "webstar" with read & write priveledges, group should be "staff" also  with read & write priveledges and "others" with read priveledges.

What's strange is the old Moodle version worked fine and nothing has been changed on the server. Perhaps some change in the latest release has made it incompatible with WebStar V. Others are complaining of log in problems since the upgrade and they're even on different platforms. Somethings changed.