Upgrading Moodle, PHP, Apache and MySQL

Upgrading Moodle, PHP, Apache and MySQL

by Chris Walsh -
Number of replies: 13
Hello,
I hope someone is able to advise me on the best way to upgrade. Here is the background.

We installed a version of Moodle about 4 years ago (onto Win2003) and it hasn't been upgraded since. Pretty much all components are heavily out of date and looking into the "upgrade" process for each component, in correct order sounds like a mammoth task.

In particular, this is what I have now and what I wish to upgrade to:

TABLE#mytable { border-collapse: collapse; } TABLE#mytable TD { border: solid 1px black; padding: 4px; }

Current
Version
Target
Version
Apache 1.3.33 2.2
PHP 4.3.10 5.2.6
MySQL 4.1.9 5.1.31
MySQL Admin 2.6.1 3.1.2
Moodle 1.6? 1.9.4

As you can see, many components will require intermediate series upgrades before reaching the latest version and many components at different versions only work with other components with a certain version range.

I am at ease with installing a "latest" WAMP environment + "latest" Moodle from a fresh install (takes me about 90 minutes) but treading through upgrades is going to be a miindfield - I've already read and reread a load of "installation/upgrade considerations" documents but I am getting lost as to even where to start.

Questions:
Is there a way for me to take my current "moodledata" folder and (old) moodle mysql backup and drop them into a fresh installation of the latest WAMP + Moodle environment?

If so, would this be my best way to avoid all the pitfuls of upgrade steps required?

If this is not an option, can anyone provide any clues as to how to structure the upgrade process?

Finally:
- I believe I have v1.6 of moodle installed. How can I check this reliably?
- How can I reliably check that my current version is fully unicode enabled? (one of the items mentioned in the moodle upgrade)

Thanks,
Chris







Average of ratings: -
In reply to Chris Walsh

Re: Upgrading Moodle, PHP, Apache and MySQL

by Chris Walsh -
Found our moodle version. It is Moodle 1.5 (2005060201).
In reply to Chris Walsh

Re: Upgrading Moodle, PHP, Apache and MySQL

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I would recommend.
  1. Set up and up-to-date version of LAMP on a new server.
  2. Copy everything (moodle code folder, moodleddata and database) onto the new server, and ensure that your old Moodle works well on the new platform.
  3. Upgrade Moodle -> 1.6.x -> 1.8.x -> 1.9.x, checking after each stage that everything seems to be OK.
Acutally, first I would do a practice run to check everything out. And then repeat the process for real when you are confident that it will work.
In reply to Tim Hunt

Re: Upgrading Moodle, PHP, Apache and MySQL

by Phill Pover -
That's pretty much what I was going to say. Get the server environment up and running first (either through an AMP setup or setting up apache, mysql and php individually [which I now prefer as each can be upgraded and tested individually]) then worry about upgrading moodle. I've not upgraded moodle from one that old before, as I've only been working on moodle for about 6 months (started on 1.9.2 and now on 1.9.4), so probably take advice from someone else on that process, but I did swap out XAMPP for the individual platforms and that was the best decision I made. Apache et al are so much more stable running on a windows server using the Apache Lounge release rather than XAMPP's. It's definitely something to consider.

-Phill
In reply to Phill Pover

Re: Upgrading Moodle, PHP, Apache and MySQL

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Well, on Linux, you will probably use the operating system's package manager to install and upgrade Apache, PHP, MySQL etc.

Also, I should have given the Upgrading link before.
In reply to Tim Hunt

Re: Upgrading Moodle, PHP, Apache and MySQL

by Chris Walsh -
But how do I migrate a "MySQL 4.1.9" database to a "MySQL 5.1.31" database?

(I am referring to the physical databse files that make up the moodle data rather than the MySQL Server Application.)



In reply to Chris Walsh

Re: Upgrading Moodle, PHP, Apache and MySQL

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I am not a MySQL expert, but

Option 1. Find where MySQL stores its data files on disc, and copy them from the corresponding place on one server to the other. So this with MySQL shut down. See if MySQL on the new server will start up and let you access the data in the tables you copied like this.

Option 2. If the first method fails, mysqldump the old database, and then load the dump into the new database. Google will find you step by step instructions for that. Actually, I think there are some in Moodle Docs.
In reply to Tim Hunt

Re: Upgrading Moodle, PHP, Apache and MySQL

by Chris Walsh -
Thanks Tim, I will give those options a go and report back. approve
In reply to Tim Hunt

Re: Upgrading Moodle, PHP, Apache and MySQL

by Phill Pover -
I would not recommend option 1, this is way more likely to fail than option 2, which is the way I would do it.

MySQLDump outputs the data as plain text formatted to be reloaded into almost any version of MySQL, as long as the dump is set up properly, you should have no problems loading that into a newer version. Loading the stored databases on disk into a much newer version of MySQL is unlikely to work as the way the data is stored in these files changes from version to version, it's possible that the new version just wont be able to read them, or if it can there's the possibility of corruption occurring at various stages.

Below is part of a bat file that I run daily to backup all my databases as a dump:

 FOR /F "tokens=1-4 DELIMS=/ " %%F IN ('date /T') DO (set v_date=%%F%%G%%H)
 FOR /F "tokens=1-4 DELIMS=: " %%F IN ('time /T') DO (set v_time=%%F%%G%%H)
 set fname=database_backup_%v_date%_%v_time%.sql
 set lname=database_backup_%v_date%_%v_time%.log
 echo %v_time%
 echo %fname%
 c:\mysql\bin\mysqldump.exe --add-drop-table -u root -pPASSWORD moodle --log-error=C:\mysql\mysqlbackups\logs\%lname% > C:\mysql\mysqlbackups\%fname%
Save it as a bat file, adjusting password and the location of files and run it whenever you want a backup of MySQL's data. To load this back to MySQL use:

mysql -u root -pPASSWORD moodle < C:\mysql\mysqlbackups\filename

Hope this helps.
-Phill
In reply to Tim Hunt

Re: Upgrading Moodle, PHP, Apache and MySQL

by Frank Ralf -
You can find some instructions in Site backup. I would recommend using one of the tools mentioned there for backing up and restoring your database.
In reply to Tim Hunt

Re: Upgrading Moodle, PHP, Apache and MySQL

by Chris Walsh -
Thanks Tim, for your recommendation.

I can do #1 (Set up and up-to-date version of LAMP on a new server)

I can do #2 (Copy everything (moodle code folder, moodleddata and database) onto the new server, and ensure that your old Moodle works well on the new platform)
except.... if I copy the moodle database across (MySQL 4.1.9) to the new server (MySQL 5.1.31) will the tables work? Will they plug and play?

As I am comfortable about installing a new W/LAMP platform then as long as the MySQL database plugs and plays then that will half my problem - I will then only need to worry about #3 (Upgrade Moodle -> 1.6.x -> 1.8.x -> 1.9.x, checking after each stage that everything seems to be OK)

(Actually
, first I would do a practice run to check everything out. And then repeat the process for real when you are confident that it will work.)
I was planning to do that anyway so your advise is reassuring.
In reply to Chris Walsh

Re: Upgrading Moodle, PHP, Apache and MySQL

by Richard Enison -
CW,

  1. I agree with most of what has been said before, such as doing the s/w upgrades first, then Moodle; and upgrading to 1.6, then 1.8, and finally to 1.9. I would add that at each stage, it is a good idea to back everything up, especially the database. And be sure to read not only Upgrading, but Upgrading to Moodle 1.6, Upgrading to Moodle 1.8, and Upgrading to Moodle 1.9. If you do, you will learn what you need to do to migrate your database to Unicode while you are at 1.6. Unicode databases were not supported before 1.6, were optional in 1.6 and 1.7, and are required from 1.8 on. Therefore, the script that migrates to Unicode is only available in 1.6 and 1.7.
  2. If you copy the database to the new server by
    1. doing a mysqldump on the old server,
    2. creating an empty database on the new server, and
    3. running mysql on the new server with the dump file as input,
as PP suggests, the tables should work, provided the new database is not Unicode (remember 1.5 does not support that yet). Don't worry, the default in MySQL is not Unicode, so unless you deliberately take action to make it Unicode, it should be okay.

RLE
In reply to Richard Enison

Re: Upgrading Moodle, PHP, Apache and MySQL

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
When upgrading 1.6.x please upgrade directly to 1.9.x, if there are any problems please report them into tracker. Going through 1.8.x upgrade step has some minor issues wink
In reply to Tim Hunt

Re: Upgrading Moodle, PHP, Apache and MySQL

by Robert Brenstein -
> and ensure that your old Moodle works well on the new platform.

It is certain that Moodle 1.5 will have some glitches with newest PHP, so I would not worry too much about the "working well" part.