Windows installation using XAMPP
XAMPP is a fully functional web server package. It is built to test web based programs on a personal computer. It is not meant for online access via the web on a production server. This page describes how to install the XAMPP webserver package of programs and how to install a Moodle standard package on the server which was created.
- TIP: These guidelines are intended for a Standard Moodle installation on a Windows PC for a private or test Moodle installation, not a production (public) site or service. XAMPP-lite is used to create a Complete install packages for Windows which has a different installation process.
Note: This page was updated showing an installation for XAMPP 1.7.1 but some older screenshots were kept. It is now October 2015 and XAMPP's current version is 5.6.8 and Moodle's is 2.9.2 going on 3.x. Windows is no longer supporting XP, Windows 10 is the desktop latest and greatest. Some updating is in order. See page comments.
This is a guide for installing XAMPP and Moodle on a computer. The instructions are in the process of being updated. You may find the older instructions in previous versions of MoodleDocs.
An overview of the steps as of 2015:
- Download the latest version of XAMPP from Apachefriends.org
- Install XAMPP
- Use control.exe in XAMPP folder to start and stop Apache and MySQL
- Note the MySQL port.
- If Apache will not start because of a port conflict
- then use config button to change the listening port to something like 127.0.0.1:181
- Type localhost in your browser, or 127.0.0.1:181 (if you changed the port number)
- You should get to localhost/xampp splash page.
- Click on the Moodle icon to allow Bitnami to install the latest version of Moodle.
- You will need to know port number and the usual Moodle Installation initial questions.
- The process takes a long time. Be patient, even when things don't look like anything is happening.
- You should find your moodle files in /xampp/apps/moodle/htdocs. Enjoy.
What follows are old XP instructions which will not help much.
Download the standard version of Moodle you wish to install from Moodle.org Standard install packages.
Alternative, once XAMPP is installed use the Moodle link and allow Bitnami to download a current version and start the free install for you.
Go to apachefriends.org and download XAMPP for Windows. This example assumes that you have downloaded the “Installer” package. There are several XAMPP packages to download. Installer is about 1/2 the size of the same package as a zip file.
Allow yourself some time
Allow an hour or more to get to the Moodle Front Page on a new site. The time will depend upon the speed of your computer, download connection and of course your familiarity with the process.
- TIP: On slower internet connections, download what you need into a folder for a later install. The serious moodler might create a MoodleZip folder to put all their different Moodle related zipfiles.
Create XAMPP webserver
Run the installer, eventually you will be presented with an option about where to install the package. A best practice is to give the xampp folder a name that is unique. For example in C:\xampp568
Continue with the installation, this will take a while!
Eventually you will be presented with the option to install Apache, MySQL, Filezilla and Mercury as a service.
- It’s probably best to choose “No” for now. You can always enable these as services later.
Next you’ll be asked if you want to start the XAMPP Control Panel. Say yes. You can find the XAMPP-control.exe file in your XMAMPP folder. It is useful.
There are several ways to start your webserver.
1. On your Desktop, locate the shortcut XAMPP icon and double click to launch the Control Panel.
- When the XAMPP Control Panel has launched, click the “Start” buttons for Apache and MySQL (see below).
2. Alternatively, there are several start stop bat and exe files in the xampp folder. The XAMPP-control.exe file takes the place of these.
- If all is well you will see something like this.
If Apache fails to run i.e. the "Running" text with the green background keeps disappearing) and you are using Skype or another program that uses port 80 e.g. IIS - please review "Troubleshooting" at the end of these instructions.
Create the MySQL database
To create a MySQL database for your Moodle “site” we will use the phpMyAdmin utility included with XAMPP.
- To access this launch the web browser of your choice (Firefox is used in this example), type local host or http://localhost/xampp/ in the address bar.
- The XAMPP default page will be displayed which means your webserver is working. Click the link for your preferred language – we will be using English.
- From the menu on the left, click on “phpMyAdmin”
- When phpMy Admin has launched in your browser window, enter the name of your database in the “Create new database” field. Usually this is simply moodle, but you might say moodle310.
- From the "Collation" drop down list select "utf8_unicode_ci"
- Click the “Create” button to create the database.
You should see the database on the left with your moodle MySQL database name without files in it and/or a notice that it was created.
Security on a localhost may not be a big concern. On the XAMPP page there is a security link on the left. It will help you create a MySQL user and security password. Usually this user is called root.
Prepare server for Moodle
You will need to extract the folders and files from the downloaded package and create the moodledata folder (where images, course and user data/files will be located).
Extract standard Moodle package files
Locate the zip file of the standard install package you downloaded from Moodle.org. The easiest method is to extract everything in the file to the htdocs folder that XAMPP just created. Most Windows operating systems come with an program that will recognize a zip file and ask you where you want to extract the files.
- Extract the Moodle files to htdocs. A default folder named “moodle” is created with all the Moodle folders and files within it.
It is a good practice to manually create the moodledata folder. In an standard default install, Moodle will look for it in the top most level of folders on your server, the same level as htdocs, apache, php and those folders. If you anticipate adding different versions of moodle on your XAMPP server, give the moodledata folder a unique name.
- For example: "C:\X_server\moodledata301" or "C:\apachefriends\151\moodledata151".
- You may have to change the permissions of the folder in some operating systems. To do this right click on the moodledata folder, select properties and the "Security" tab.
- Another box will pop up. Select "Users" and give them "Modify" and "Write" permissions, along with whatever existed already.
Start of initial Moodle install
You have now installed a webserver on your computer. Next you need to get Moodle to install itself. You will use your favorite web browser to do this.
Other pages in MoodleDocs describe the install process. We will just cover the first few screens.
Go to moodle in web browser
In your web browser, type the path to the folder containing the Moodle files in te address bar – in this example it’s http://localhost/moodle.
The initial install page will ask you to choose your preferred language.
- Click the “Next” button.
A diagnostic report is displayed – hopefully it will look like this, if not you may need to address some issues.
- Click the “Next” button to continue.
Paths for Moodle installation
The paths for your Moodle installation are shown – accept these or amend as desired.
- Click the “Next” button to continue.
MySQL database settings
The screen shot below is out of date. However, enter the database settings. The fields are populated with some suggested values.
- In this example the database created is “moodle153”. If you created a password for root place it here. If you want the MySQL user admin to log into the moodle MySQL database, place that user and the password here.
- In later versions of Moodle you maybe asked for the database port number. Refer to the XAMPP-Control.exe program main screen for that information.
- TIP: DO NOT USE THE “ROOT” USER WITHOUT A PASSWORD FOR PRODUCTION INSTALLATIONS AS THIS CREATES A SECURITY VULNERABILITY.
- When you have added or edited information on the page, click the “Next” button to continue.
- TIP: This information is creating and can later be edited in the htdocs/moodle/config.php file.
- TIP: It is possible to open Windows Explorer and edit the php/php.ini file using a plain text editor e.g. notepad at this point and then use the refresh button at the bottom of the server check page once you have saved your changes. However, exiting the Moodle install at this point is not the end of the world, all your settings up to this point have been saved. Localhost\moodle will start the install again.
Moodle install confirmed
Moodle will tell you it has install the basics.
- Click the “ Continue” button to proceed.
Moodle copyright & license
The Moodle copyright / license notices are displayed.
- Click the “Yes” button to continue.
Now you can Moodle
You will be asked to create the admin user for your Moodle site. Then as the admin Moodle user, you will be taken to the Front Page settings to start to build your new site. Good job
- If you have previously created a Moodle install with the Bitnami installer you may find that Apache will not start. This is because Bitnami installs a service for Apache and MySQL. To disable these go to Control Panel > Administrative tools > Service to locate and disable these services.
- If XAMPP does not work when you launch your browser and you have Skype enabled it may be necessary to change the port settings. You may also have issues with other programs and it might be easier to change the port settings in XAMPP and Moodle. Here is how to change them in Skype.
- Locate "Options..." in Skype.
- Locate the "Connection" options.
- Remove the tick / check from the Checkbox.
- Click the "Save" button.
- You may need to re-start your computer for this to take effect.
- Or you can quit your Skype session while you are working on Moodle.
Still having problems but do not have Skype installed, using Windows 10?
- Check for another program which may be using port 80. IIS is commonly found to be the culprit. You can put the service called World Wide Web Publishing Service on manual. If you use MS's Shared space, then do not fight city hall, leave it running.
You can change the port for you XAMPP webserver. The easiest way is to use XAMPP-Control.exe, then click on the config button for Apache. This will open up the httpd.conf file. Look for the Listen lines. A best practice is to comment out (with a #) the current active line and type in a new line. For example you might type Listen 127.0.0.1:181
Next you will need to go to the Moodle config.php file and change the wwwroot location by adding the port to the address. For example: $CFG->wwwroot = 'http://127.0.0.1:181/moodle';
Don't forget to save the file and restart Apache.
Moodle Networking does not work
Example of a Moodle 2.9 config.php file
Here is a Moodle 2.9.1 configuration file. A port has been added to the localhost ip for wwwroot. This webserver can run multiple versions of Moodle. The moodle and moodledata folders have unique names. The MySQL database name is standard and the tables' prefix are also unique.