Windows installation using XAMPP: Difference between revisions

From MoodleDocs
(→‎Moodledata folder: minor edits)
Line 131: Line 131:


===Diagnostic report===
===Diagnostic report===
A diagnostic report is displayed – hopefully it will look like this, if not you may need to address some issues.
A diagnostic report is displayed – hopefully it will look like this, if not you may need to address some issues. See trouble shooting below.  Generally speaking a comment with a "check" will allow you to continue. 


[[image:Xampp25.gif|thumb|center|Initial diagnostic, it passed, no warnings]]
[[image:Xampp25.gif|thumb|center|Initial diagnostic, it passed, no warnings]]

Revision as of 19:21, 9 January 2016

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.

Overview

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 is 3.0 Windows is no longer supporting XP, Windows 10 is the desktop latest and greatest.

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.

XAMPP

  • Download the latest version of XAMPP from Apachefriends.org
  • Install XAMPP - It will ask if you want to install it at C:\xampp
    • Alternatively, install in C:\xampp123 if you plan on installing more than one webserver
  • Use control.exe in the 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 http 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, your localhost webserver is running.
  • Unpack the latest version of Moodle into the c:\xampp\htdoc folder.
    • Alternative rename the moodle folder if you plan on having different versions of Moodle
    • For example rename it something like C:\xampp\htdocs\moodle31
  • In your web browser type in 127.0.0.1\moodle or 127.0.0.1:181\moodle31
  • You will need to know port number and the usual Moodle Installation initial questions.
    • Xampp uses the Mariadb database (based upon MySql), if the install says your MySQL database is too old go to the c:\xampp\htdocs\moodlel\config.php file and change the database line to $CFG->dbtype = 'mariadb';
    • If you have not changed the database password, The dbuser = 'root' and dbpass =;
  • The Moodle install process takes a long time. Be patient, even when things don't look like anything is happening.

XAMPP using Bitnami to install Moodle

  • 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 Moodle install process takes a long time. Be patient, even when things don't look like anything is happening.


What follows are old XP instructions which will not help much.

Preparation

Get Moodle

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.

Get XAMPP

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

Installing XAMPP

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.

Launch XAMPP

There are several ways to start your webserver.

Server directory start/stop files
One way to start/stop: XAMPP control panel

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.

Option create the database

In some older versions of Moodle, it was necessary to created the database before Moodle could install the tables as part of the install process. In Moodle 3.x this is not necessary. However, you can create the database before starting the Moodle install and then put that database name when Moodle asks for it. While these instructions refer to MySQL, they also work for MariaDB which is part of XAMPP.

To create a MySQL database for your Moodle “site” we will use the phpMyAdmin utility included with XAMPP.

  • To access phpmyadmin launch the web browser of your choice, type localhost/phpmyadmin or 127.0.0.1/xampp/ in the address bar.
  • If you have set a password you will be prompted for it.
  • 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.

MySQL security

Security on a localhost may not be a big concern. The recent versions of XAMPP do not set a password for root, the superuser. Go to the file C:\xampp\phpmyadmin\config.inc.php, edit the line $cfg['Servers'][$i]['password'] = ; For example to:

$cfg['Servers'][$i]['password'] = 'password2016';

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. If you anticipate wanting to have different versions of Moodle on this web server, change the name of the3 folder from moodle to say "moodle31' and then the next one to say "moodle35", etc.

Moodledata folder

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, and php folders. If you anticipate adding different versions of moodle on your XAMPP server, give the moodledata folder a unique name.

  • For example: "C:\xampp\moodledata301" or "C:\xampp\moodledata350".
  • 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

Browser address

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.

Select language

The initial install page will ask you to choose your preferred language.

Select language
  • Click the “Next” button.

Diagnostic report

A diagnostic report is displayed – hopefully it will look like this, if not you may need to address some issues. See trouble shooting below. Generally speaking a comment with a "check" will allow you to continue.

Initial diagnostic, it passed, no warnings
  • 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 interface on this screen changes over time. However, the database settings fields are the same in 3.0. 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.
  • As a best practice, change the "mdl_" prefix to something else, perhaps "mdl_30_". This will allow you to install multiple version of Moodle, each with there own table.
  • 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. The default maybe 3306.
TIP: You may want a separate database for each version of Moodle. UsephpMyAdmin to create the database (remember should be UTF-8)with a name something like moodle30. Then on this screen put the new database name there.
TIP: DO NOT USE THE “ROOT” USER WITHOUT A PASSWORD FOR PRODUCTION INSTALLATIONS AS THIS CREATES A SECURITY VULNERABILITY.
MySQL database settings screen
  • 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.

Server check

Server check with minor issues

This screen will report any issues with your webserver settings. Typically the CURL settings and OpenSLL settings in a new XAMPP install will receive a mild or critical warning.

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.

Confirmed
  • Click the “ Continue” button to proceed.

Moodle copyright & license

The Moodle copyright / license notices are displayed.

Copyright & license


  • 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 !

Troubleshooting

Bitnami

  • 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.

Skype

  • 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

You may need to enable curl. Curl help which will tell you the line of code in the php/php.ini file to change. Or find more instructions at this link Enable curl in XAMPP on XP

Installs but will not load after creating admin

You install Moodle, your browser takes forever and then it tells you it can not find the page. [Ken White gave excellent instructions here] in 2013 which also worked with on 3.0 install in 2015.

Have had to do this once on a stubborn server ...run this from your browser
http://server/admin/purgecaches.php
and it that might work.  
If not continued to physically removed the contents of:
/moodledata/cache/cachestore_file/default_application
which is what the purgecaches.php script was to do.
At that point, clear the browser cookies and cache (or open another browser) and try it again.

See also