Note: this is a work in progress - it may not be complete or accurate yet until fully tested.
This page is intended to help you when you have:
- A Windows server that uses XAMPP or the XAMPP-based package from the Moodle downloads page
- A Moodle installation that has been running for a while and has accumulated data and users
- Some need to upgrade all or part of the webserver (Apache, PHP, MySQL) to a newer version e.g.
- You need a higher version of PHP for Moodle 2.0
- You are suffering from the dreaded Apache memory leak problem
- You are following best practice by keeping all components updated to include the latest security improvements and bugfixes
Here's what to do:
Assemble the components
You will need:
- To download the latest XAMPP or windows installer package e.g. from http://download.moodle.org/windows/
- The latest Moodle code if it wasn't included in the above
- To have sufficient hard-drive space to backup your existing install in its entirety (preferably to another machine).
- At least an hour of free time, possibly up to three - the backups can take forever depending on how big your install has become and troubleshooting can be a pain.
You don't want to use Moodle's internal backups system as this will make things take an age. The idea is to backup the entire database into a text file, ready for the new webserver to rebuild it. You can then copy various component files from your old webserver directory across to the new one and all should be well.
- Log into the server with administrator privileges
- It is vital to back up the entire XAMPP directory to another machine/hard-drive/USB-drive at this point.
- Backup your database as follows:
- Open a command prompt using Start->run and typing cmd
- type "cd path_to_your_webserver\mysql\bin\" without the quotes and substituting the actual path where your webserver is
- type "mysqldump.exe --user=your_MySQL_user --password=your_MySQL_password your_database_name > backup.sql" without the quotes and substituting the real values from your config.php file
Put the files in place
Note: if you made the previous install yourself, this will be a lot easier. If you have inherited it, this part is a minefield. Use a diff application to compare httpd.conf and php.ini in the old and new packages. Also check apache\modules and php\ext carefully for extra files.
- Place the new XAMPP or windows package where you want it to be, but leave the existing (working) install where it is, so you can go back to it if everything fails.
- disable the existing install by shutting down Apache and MySQL
- run the XAMPP install script on the new install. This will give you a blank Moodle that should work. Run the stop Moodle script afterwards. (if plain XAMPP, run the setup_xampp script)
- (optional) copy across any extra files and settings that you added to the old one e.g. extra php modules to make authentication work. e.g. if you need the apache SSPI module, copy the file across from apache\modules\ on the old install to the same place on the new install and add the "LoadModule auth_sspi_mod.so" line to apache\conf\httpd.conf. This will be more of an issue if you are just using XAMPP (not the windows package from Moodle), which may need extra tweaking to get all of the needed extensions working.
- check the original apache\conf\httpd.conf for information relating to your domain. You may need to copy over a line like "ServerName www.yourmoodle.com" in order to make it respond to requests.
- If https is in use, you will need to
- copy over the certificate files - server.crt & server.key from apache\conf\ as well as apache\conf\extras\httpd-ssl.conf.
- Make sure the "Include conf\extra\httpd-ssl.conf" line in httpd.conf has no leading # symbol
- go through httpd-ssl.conf, changing all occurences of the old webserver location to the new one
- If virtual hosts are in use, you will need to:
- copy over the apache/extra/httpd-vhosts.conf file
- go through it changing all occurences of the old webserver location to the new one
- copy backup.sql from mysql\bin\ to the equivalent place in the new install
- copy across the entire Moodle folder from the old to the new install. Its best to make sure everything works before attempting to upgrade the Moodle install itself.
Restore the database
- Open the command prompt again, as above and navigate to mysql/bin in the new webserver folder.
- type "mysql --user=your_new_MySQL_user --password=your_new_mysql_pasword your_new_database < backup.sql" (no quotes), substituting the username, password and database that you created when you ran the new install script.
- start the new webserver's apache and mysql