Upgrading XAMPP

Jump to: navigation, search

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.

Backup everything

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.

  1. Log into the server with administrator privileges
  2. It is vital to back up the entire XAMPP directory to another machine/hard-drive/USB-drive at this point.
  3. Backup your database as follows:
    1. Open a command prompt using Start->run and typing cmd
    2. type "cd path_to_your_webserver\mysql\bin\" without the quotes and substituting the actual path where your webserver is
    3. 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.

  1. 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.
  2. disable the existing install by shutting down Apache and MySQL
  3. 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)
  4. (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.
  5. 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.
  6. If https is in use, you will need to
    1. copy over the certificate files - server.crt & server.key from apache\conf\ as well as apache\conf\extras\httpd-ssl.conf.
    2. Make sure the "Include conf\extra\httpd-ssl.conf" line in httpd.conf has no leading # symbol
    3. go through httpd-ssl.conf, changing all occurences of the old webserver location to the new one
  7. If virtual hosts are in use, you will need to:
    1. copy over the apache/extra/httpd-vhosts.conf file
    2. go through it changing all occurences of the old webserver location to the new one
  8. copy backup.sql from mysql\bin\ to the equivalent place in the new install
  9. 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

  1. Open the command prompt again, as above and navigate to mysql/bin in the new webserver folder.
  2. 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.
  3. start the new webserver's apache and mysql
  4. test!

See also