Unable to upgrade to Moodle 1.5 on a Mac

Unable to upgrade to Moodle 1.5 on a Mac

by Jim Hardy -
Number of replies: 34
I've not seen this issue addressed so here I go.

Moodle worked perfectly on my Mac mini (Mac OS 10.3.9 and Moodle version 1.4.2). After upgrading to Moodle version 1.4.5, my forums ceased to function - returning blank pages more often than not. So, I decided to upgrade to Moodle 1.5.

Fortunately, I've made the attempt on my home 'network' so as not to impact my students because it has been a nightmare - consistently resulting is a site that doesn't function.

Basically, after following the upgrade instructions (and successfully updating the databases), I can no longer login to my site. I'm consistently told that I can't login because "cookies are currently not enabled in your browser". I get the same message with Safari, IE and Foxfire - and cookies are enabled in each case.

If I restore from my backup of the old site, I can again get everything (except forums) to work just fine.

I'm using WebSTAR 5.4, PHPStar 3.0, Mac OS 10.3.9 and constant prayer.

If I could fix the blank page forum problem, I'd be OK - although being able to upgrade would be nice.

Any suggestions would be appreciated.

Thanks.

Jim Hardy
Professor of Chemistry
The University of Akron
http://ull.chemistry.uakron.edu

Average of ratings: -
In reply to Jim Hardy

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Jim Hardy -
Can I assume that I'm the ONLY person with a Mac and wanting to upgrade to v 1.5?

At least I found a work around for the blank forum pages. First, it seems that only the latest post can be displayed. However, I found the option to have all forum posts emailed to all course members. Not the best solution but at least one that my students can use.

I still hope that someone can suggest what I can try to solve the cookie problem since I'd really like to be able to upgrade.
In reply to Jim Hardy

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Richard Arnett -
I have an old G3 imac running OSX 10.3.9. I have just upgraded to Moodle 1.5 without serious issue. The difference is probably, as already outlined, that I am using the built-in Mac web software. So there are quite a few of us Mac Moodlers out there, but being Mac users we don't have as many problems as those PC types and therefore don't show up on the forums as much wink!
In reply to Jim Hardy

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Tony Hursh -
Just curious: why are you using WebStar when OS X comes with the excellent, free, and industry standard Apache web server already installed? All of the other stuff that WebStar provides (ftp, POP, SMTP, etc.) is also built-in to OS X.

I would conjecture that you haven't gotten any replies because very few people are using that specific software configuration.

Unless you have an utterly compelling reason for sticking with WebStar, I'd suggest ditching it and going to standard Apache/PHP/MySQL.

Edit: no disrespect toward WebStar implied; we used to have some Mac OS 8/9 servers running WebStar, and they were quite solid. Nevertheless, not many people use it as a web server with OS X. You'll probably have better luck getting help if you switch to Apache.



In reply to Tony Hursh

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Martín Langhoff -
Developing on MacOSX on Panther - Apache/PHP from Apple, MySQL from the fink packages. I use cvs to update, and my daily updates are A-OK.

And I'm not the only Martin around here using OSX ;) Martin Dougiamas recently upgraded his Powerbook -- which outshines Penny's PB and mine! It has one of those keyboards that glow in the dark. Outrageous.

The bottom line is: Moodle runs very well on OSX. As Tony mentions, WebStar isn't very compelling... nor popular. But you probably have good reasons to run it. PHP is probably finding some problem/failure. When this happens, PHP always reports the problem to a logfile, with a diagnostics message.

If you can find those diagnostic messages (and post them here) we'll probably be able to help wink Probably the WebStar documentation has something about "error logs", warnings, error messages, etc.
In reply to Tony Hursh

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Jim Hardy -
I've been using WebSTAR for as long as I've been running a web server. I guess it's better the devil you know. Afterall, I was trying to get a grasp of MySQL, PHP, UNIX and moodle. Why add Apache into the mix?

However, I doubt that the problem has anything to do with WebSTAR - or running on a Mac for that matter.

Through Moodle version 1.4.2, all worked as advertised (except the ability to upload personal images.)

With version 1.4.5, the forums got odd. Only the last post can be viewed AND only by the person who made the post. Any others come up blank. Fortunately the cron.php file will, among other things, email all course members with any posts each day.

When I upgraded to 1.5 (stable), then it became impossible to login. Oh, I could get the databases to update and everything was listed as successful. However, when trying a normal login, I keep being told that I don't have cookies enabled - which is untrue. I get exactly the same effect on three Mac browsers and even IE and Netscape on a WinDOZE box.

I made no upgrades to PHP, MySQL or WebSTAR - just moodle. It has to be a problem with the login routine.
In reply to Jim Hardy

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Tony Hursh -
Here's another person who's having trouble with WebStar.
In reply to Tony Hursh

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Jim Hardy -
Thanks, from the posts, it still looks like a problem with Moodle 1.5

Still, I tried an experiment with my nonfunction 1.4.5+ forums. Since I couldn't locate where the PHP error log was, I took a different approach. Near the start of the file

/mod/forum/discuss.php, (after the phplib was loaded) I added a phpinfo(); line.

Up popped the complete PHPInfo display and then at the very bottom - there was the forum post - properly formatted. Every forum post could be displayed. Of course, it's not a solution.

So, how could inserting a single phpinfo(); line have that effect?
In reply to Jim Hardy

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Thomas Robb -
It might help if we knew whether the forum code was actually being generated and then simply not displayed.  When you say that a 'blank page' appears, what does 'view source' show?  With some browsers, if there is an unclosed TABLE tag or something else wrong with the tags for the table layout, the result is that nothing appears.

Have you tried looking at the same page with other browsers? Some are more forgiving of HTML errors than others.
In reply to Jim Hardy

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Martín Langhoff -

Thanks, from the posts, it still looks like a problem with Moodle 1.5

Hmmm. I suspect a permission issue -- make sure the folder where Moodle is set to has "Others->Read only".

Did you try to get to the error logs? Webstar and PHP are certainly logging the problem somewhere. If you can find those logs, then we'll be able to help. The Webstar documentation will probably tell you where to find them.

In reply to Martín Langhoff

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Jim Hardy -
The error message that shows up in the WebSTAR launcher window 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.

This is for my moodle 1.5 installation where I can't get past the login window because it claims my browser isn't set to accept cookies - the same three browsers were tried.
In reply to Jim Hardy

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Tony Hursh -
Jim, you may have an extraneous blank line in your config.php file. These words: headers already sent should be highlighted when you see them. Click on them for more information.


In reply to Tony Hursh

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Jim Hardy -
Nope. No spaces or blank lines at the end. I restored from an earlier version that functioned and repeated the upgrade process.

I do get "Expires: Acept-Ranges: none" that shows up at the top of the login page.

Oddly, I attempted to include the config.php file within the body of this message and it would never show up. When I went to edit the post, the information was there. Odd. I've attached it this time.
In reply to Jim Hardy

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Martín Langhoff -
I have to agree with Tony, 99.9% that there's a trailing newline after the "?>" closing tags somewhere, probably in your config.php

Try to use a unixy editor (vi, emacs, nedit, etc) rather than a native mac editor to remove it.
In reply to Martín Langhoff

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Zbigniew Fiedorowicz -
The following tool
https://webwork2.math.ohio-state.edu/configcheck.php
can be used to check a Moodle site for trailing newlines.
In reply to Zbigniew Fiedorowicz

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Jim Hardy -
I use BBEdit to edit files - set to save in UNIX format.

I can't used the configcheck.php routine because my test site is on my home local net.
In reply to Jim Hardy

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Jim Hardy -
My brain finally kicked in, realizing that all I needed to do was to put a copy of the config.php file on my production server (under a different name). It passed.
In reply to Jim Hardy

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
try changing your theme - you aren't using formal_white are you? - there seems to be trailing whitespace at the bottom of formal_white\config.php - Theres a bug in bugtracker if someone wants to fix it! smile

-unless it's just my copy that ended up with the carriage return somehow.......
In reply to Dan Marsden

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Jim Hardy -
Formal White? That must be a theme new with 1.5. I'd been using the standard blue with 1.4.x. Then again, the screen does come up white. I guess that's the next thing to check.

Thanks.
In reply to Jim Hardy

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Zbigniew Fiedorowicz -
I believe the problem is due to Petr Skoda having added some debugging code to the HTTP headers in Moodle 1.5, to trap the session switching problem on some web servers. This debugging code sets several Moodle cookies in the header as opposed to a single cookie in Moodle 1.4.

Here is the Moodle 1.5 HTTP header on my web server:

Date: Mon, 27 Jun 2005 02:02:48 GMT
Server: Apache/1.3.31 (Unix) PHP/4.3.8 mod_perl/1.29 mod_ssl/2.8.19 OpenSSL/0.9.7a
X-Powered-By: PHP/4.3.8
Set-Cookie: MoodleSession=a1141372f2c092efba8baa93b9a57c9b; path=/
Expires:
Cache-Control: private, pre-check=0, post-check=0, max-age=0
Pragma: no-cache
Set-Cookie: MoodleSessionTest=fhHPv1V4zh; path=/
Set-Cookie: MOODLEID_=deleted; expires=Sun, 27-Jun-2004 02:02:47 GMT; path=/
Set-Cookie: MOODLEID_=%25ED%25C3%251CC%25B7d; expires=Fri, 26-Aug-2005 02:02:48 GMT; path=/
Accept-Ranges: none
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1

Contrast this with the Moodle 1.4 HTTP header on my web server:

Date: Mon, 27 Jun 2005 02:03:40 GMT
Server: Apache/1.3.31 (Unix) PHP/4.3.8 mod_perl/1.29 mod_ssl/2.8.19 OpenSSL/0.9.7a
X-Powered-By: PHP/4.3.8
Set-Cookie: MoodleSession=fb477851628afb37be0fd7fdcfdad23f; path=/
Expires:
Cache-Control: private, pre-check=0, post-check=0, max-age=0
Pragma: no-cache
Accept-Ranges: none
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1

What is happening is that WebStar is confused by the more complicated Moodle 1.5 header and is sending its own default header on top of the Moodle 1.5 header. This causes the Moodle header to appear in the body of the web page, mucking things up. [This causes the headers already sent error message.]

Note that WebStar is sometimes also confused by the Moodle 1.4 HTTP headers. Here is a case in point:
http://classroom.chemistry.uakron.edu/filter/tex/texdebug.php
Click on Show Image and you will see what I mean.

In reply to Zbigniew Fiedorowicz

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Zbigniew Fiedorowicz -
Here is a possible fix.  Look through your php.ini file and change the line

output_buffering = Off

to

output_buffering = On

(Or add this line if there isn't any mention of output_buffering in php.ini).

Remember to restart your web server after making this change.
In reply to Zbigniew Fiedorowicz

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Jim Hardy -
The line in my php.ini was

output_buffering = 4096

I changed it to

output_buffering = On

No luck, same result.

I really appreciate your suggestions and help. Off hand, how would I go about testing your theory about the headers being too complex?
In reply to Jim Hardy

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Zbigniew Fiedorowicz -
Then try
output_buffering = Off

Also you might use the following PHP script:

<?PHP
header("Set-Cookie: MoodleSession=a1141372f2c092efba8baa93b9a57c9b; path=/");
header("Expires:");
header("Cache-Control: private, pre-check=0, post-check=0, max-age=0");
header("Pragma: no-cache");
header("Set-Cookie: MoodleSessionTest=fhHPv1V4zh; path=/");
header("Set-Cookie: MOODLEID_=deleted; expires=Sun, 27-Jun-2004 02:02:47 GMT; path=/");
header("Set-Cookie: MOODLEID_=%25ED%25C3%251CC%25B7d; expires=Fri, 26-Aug-2005 02:02:48 GMT; path=/");
header("Accept-Ranges: none");
header("Content-Type: text/html; charset=iso-8859-1");

echo "Testing Header";
?>

Save this somewhere in a file testheader.php where your web server can see it and try viewing it. [Make sure that "<?PHP" is the first line and "?>" is the last line in the file.] You should only be seeing the line "Testing Header". If my hypothesis is correct however, you should be seeing some header junk on top of the "Testing Header". Then try commenting out the various Set-Cookie lines and repeat the experiment until the header junk disappears. (Note that the MoodleSession cookie is required for Moodle to work, but the other cookies are not really necessary.)

In reply to Zbigniew Fiedorowicz

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Jim Hardy -
Well, the output_buffering = Off didn't help so I set it back to the default.

I tried your testheader.php program and got the following.

Expires: Cache-Control: private, pre-check=0, post-check=0, max-age=0 Pragma: no-cache Set-Cookie: MOODLEID_=%25ED%25C3%251CC%25B7d; expires=Fri, 26-Aug-2005 02:02:48 GMT; path=/ Accept-Ranges: none Content-Type: text/html; charset=iso-8859-1 Testing Header

Unfortunately, I need to go and teach class so need to get going.

One question though. If removing the unneeded cookies works, do you know what I need to change to fix the problem?

Thanks again.
In reply to Jim Hardy

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Zbigniew Fiedorowicz -
Why don't you ask WebStar technical support if you can configure WebStar not to do this? If you can't turn off this behavior, then WebStar is seriously broken.

As for disabling the extra Moodle cookies, you would need to do the following.  In lib/moodlelib.php comment out the following lines:

//setCookie($cookiename, '', time() - HOURSECS, '/');

//setCookie($cookiename, rc4encrypt($thing), time()+$seconds, '/');


and also add the following line indicated in red:

function get_moodle_cookie() {
    global $CFG;

    return 'somebody';
    
Then in lib/setup.php comment out the following line:

//setcookie('MoodleSessionTest'.$CFG->sessioncookie, $_SESSION['SESSION']->session_test, 0, '/');

and change the line

    if ($SESSION != NULL) {

to
    if (0) {

Be sure to keep backups of both moodlelib.php and setup.php
In reply to Zbigniew Fiedorowicz

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Jim Hardy -
Oh mighty Fiedorowicz..... I come to worship at your altar. Your latest set of modifications did the trick. I can now login.

I still get "Expires: Accept-Ranges: none" at the top of each page but everything else appears to function as expected.

Now I'll post the issue on the WebSTAR list and see what they have to say.

Thanks.
In reply to Jim Hardy

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Zbigniew Fiedorowicz -
I still get "Expires: Accept-Ranges: none" at the top of each page but everything else appears to function as expected.

You can fix that too by commenting out the lines
 //       @header('Expires: ');

//    @header('Accept-Ranges: none');

in lib/weblib.php



In reply to Zbigniew Fiedorowicz

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Jim Hardy -
Yet another problem solved. Thanks again.
In reply to Jim Hardy

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Michael Penney -

We have a number of Macs running 1.5 here. In fact most of my programmers use macs, but they are all run the apache that comes built into Mac OS X (they're all running panther now), not WebSTAR.

So I would say the problem is most likely something odd going on with WebSTAR, my guess would be something odd about how it handles sessions.

Attaching a copy of your phpinfo print out might help debug the problem.

In reply to Michael Penney

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Jim Hardy -
I've attached a copy of the phpinfo output for moodle 1.4.5. I can't do the same for 1.5 since the issue is that I've never been able to get beyond the login screen with 1.5.

I just don't see how WebSTAR can be the problem. It and moodle 1.4.2 functioned flawlessly. Moodle version 1.4.5 introduced problems with forums displaying blank pages and now verrsion 1.5 won't allow anyone to login. In all cases, the version of WebSTAR has remained the same (5.40.)

My moodle related site is only part of what my web server offers. I cringe at the thought of needing to convert about 100000 pages just to use Apache in the hope that it will make moodle happy.

My bet/hope is that there is a simple fix to moodle that we simply haven't found yet. Afterall, there appear to be many other Mac OS X users experiencing similar problems.

Then again, maybe there is a way of getting a copy of moodle 1.4.2 and just forgetting about upgrades. At least it worked with no significant problems.
In reply to Jim Hardy

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Tony Hursh -
I seem to recall some serious problems with Moodle and PHP version 5.0.3. I don't know if that's related to your particular issue, but it's probably worth upgrading to 5.0.4. It looks like the PHPStar folks have 5.0.4 available now.

There were a lot of new security features in 1.4.5, too. Maybe something to do with sessions?

In reply to Jim Hardy

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Jose Carlos -
I don't Know what kind of web server is WEBSTAR, but I use a Zeus WEb server and my problem with the cookies has been solved, making the same things that we can read above.
Really I don't think that the problem is at the web server.
Thank you.
In reply to Jim Hardy

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Zbigniew Fiedorowicz -
You can run both WebStar and Apache on the same machine.  Just edit Apache's httpd.conf to use a nondefault port, e.g.
Listen 8080
instead of the default
Listen 80
You can then access the Apache server by adding ":8080" to the base url of wwwroot in your config.php:
http://example.com:8080/moodle

In reply to Zbigniew Fiedorowicz

Re: Unable to upgrade to Moodle 1.5 on a Mac

by Jim Hardy -
Just wanted to let you know that I updated my production (student) server yesterday following your advice and I've yet to see a problem.

Again, thanks for your help.