Note: You are currently viewing documentation for Moodle 3.7. Up-to-date documentation for the latest stable version of Moodle may be available here: Installing Moodle.

Installing Moodle: Difference between revisions

From MoodleDocs
Line 71: Line 71:


  '''DirectoryIndex''' index.php index.html index.htm
  '''DirectoryIndex''' index.php index.html index.htm
Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).
Secondly, '''if you are using Apache 2''', then you should turn on the ''AcceptPathInfo'' variable, which allows scripts to be passed arguments like <nowiki>http://server/file.php/arg1/arg2</nowiki>. This is essential to allow relative links between your resources, and also provides a performance boost for people using your Moodle web site. You can turn this on by adding these lines to your httpd.conf file.
'''AcceptPathInfo''' on
Thirdly, Moodle requires a number of PHP settings to be active for it to work. '''On most servers these will already be the default settings'''.  However, some PHP servers (and some of the more recent PHP versions) may have things set differently. These are defined in PHP's configuration file (usually called '''php.ini'''):
magic_quotes_gpc = 1    (preferred but not necessary)
magic_quotes_runtime = 0    (necessary)
file_uploads = 1
session.auto_start = 0
session.bug_compat_warn = 0
If you don't have access to '''httpd.conf''' or '''php.ini''' on your server, or you have Moodle on a server with other applications that require different settings, then don't worry, you can often still OVERRIDE the default settings.
To do this, you need to create a file called '''.htaccess''' in Moodle's main directory that contains lines like the following. This only works on Apache servers and only when Overrides have been allowed in the main configuration.


=== Creating a database ===
=== Creating a database ===

Revision as of 14:59, 2 July 2005

Don't panic! :-)

This guide explains how to install Moodle for the first time. For some of these steps it goes into a lot of detail to try and cover the majority of possible web server setups, so this document may look long and complicated. Don't panic, once you know how to do it you can install Moodle in minutes!

If you have problems please read this document carefully - most common issues are answered in here. If you still have trouble, you can seek help from Moodle Help

Another option is to contact a web hosting company who can completely maintain Moodle for you, so that you can ignore all this and get straight into educating!

Requirements

Moodle is primarily developed in Linux using Apache, MySQL and PHP (also sometimes known as the LAMP platform), but is also regularly tested with PostgreSQL and on Windows XP, Mac OS X and Netware 6 operating systems

The requirements for Moodle are as follows:

  1. Web server software. Most people use Apache, but Moodle should work fine under any web server that supports PHP, such as IIS on Windows platforms.
  2. PHP scripting language (version 4.1.0 or later). PHP 5 is supported as of Moodle 1.4.
  3. a working database server: MySQL or PostgreSQL are completely supported and recommended for use with Moodle. MySQL is the choice for many people because it is very popular, but there are some arguments in favour of PostgreSQL, especially if you are planning a large deployment.

Most web hosts support all of this by default. If you are signed up with one of the few webhosts that does not support these features ask them why, and consider taking your business elsewhere.

If you want to run Moodle on your own computer and all this looks a bit daunting, then please see our guide: Installing Apache, MySQL and PHP. It provides some step-by-step instructions to install all this on most popular platforms.

Download and copy files into place

There are two ways to get Moodle, as a compressed package or via CVS. These are explained in detail on the download page: http://moodle.org/download/

After downloading and unpacking the archive, or checking out the files via CVS, you will be left with a directory called "moodle", containing a number of files and folders.

You can either place the whole folder in your web server documents directory, in which case the site will be located at http://yourwebserver.com/moodle, or you can copy all the contents straight into the main web server documents directory, in which case the site will be simply http://yourwebserver.com.

If you are downloading Moodle to your local computer and then uploading it to your web site, it is usually better to upload the whole archive as one file, and then do the unpacking on the server. Even web hosting interfaces like Cpanel allow you to uncompress archives in the "File Manager".

Site structure

You can safely skip this section, but here is a quick summary of the contents of the Moodle folder, to help get you oriented:

  • config.php - contains basic settings. This file does not come with Moodle - you will create it.
  • install.php - the script you will run to create config.php
  • version.php - defines the current version of Moodle code
  • index.php - the front page of the site
  • admin/ - code to administrate the whole server
  • auth/ - plugin modules to authenticate users
  • blocks/ - plugin modules for the little side blocks on many pages
  • calendar/ - all the code for managing and displaying calendars
  • course/ - code to display and manage courses
  • doc/ - help documentation for Moodle (eg this page)
  • files/ - code to display and manage uploaded files
  • lang/ - texts in different languages, one directory per language
  • lib/ - libraries of core Moodle code
  • login/ - code to handle login and account creation
  • mod/ - all the main Moodle course modules are in here
  • pix/ - generic site graphics
  • theme/ - theme packs/skins to change the look of the site.
  • user/ - code to display and manage users

Run the installer script to create config.php

To run the installer script (install.php), just try to access your Moodle main URL using a web browser, or access http://yourserver/install.php directly.

(The Installer will try to set a session cookie. If you get a popup warning in your browser make sure you accept that cookie!)

Moodle will detect that configuration is necessary and will lead you through some screens to help you create a new configuration file called config.php. At the end of the process Moodle will try and write the file into the right location, otherwise you can press a button to download it from the installer and then upload config.php into the main Moodle directory on the server.

Along the way the installer will test your server environment and give you suggestions about how to fix any problems. For most common issues these suggestions should be sufficient, but if you get stuck, look below for more information about some of common things that might be holding you up.

Check web server settings

Firstly, make sure that your web server is set up to use index.php as a default page (perhaps in addition to index.html, default.htm and so on). In Apache, this is done using a DirectoryIndex parameter in your httpd.conf file. Mine usually looks like this:

DirectoryIndex index.php index.html index.htm

Just make sure index.php is in the list (and preferably towards the start of the list, for efficiency).

Secondly, if you are using Apache 2, then you should turn on the AcceptPathInfo variable, which allows scripts to be passed arguments like http://server/file.php/arg1/arg2. This is essential to allow relative links between your resources, and also provides a performance boost for people using your Moodle web site. You can turn this on by adding these lines to your httpd.conf file.

AcceptPathInfo on

Thirdly, Moodle requires a number of PHP settings to be active for it to work. On most servers these will already be the default settings. However, some PHP servers (and some of the more recent PHP versions) may have things set differently. These are defined in PHP's configuration file (usually called php.ini):

magic_quotes_gpc = 1    (preferred but not necessary)
magic_quotes_runtime = 0    (necessary)
file_uploads = 1
session.auto_start = 0
session.bug_compat_warn = 0

If you don't have access to httpd.conf or php.ini on your server, or you have Moodle on a server with other applications that require different settings, then don't worry, you can often still OVERRIDE the default settings.

To do this, you need to create a file called .htaccess in Moodle's main directory that contains lines like the following. This only works on Apache servers and only when Overrides have been allowed in the main configuration.

Creating a database

Creating a data directory

Go to the admin page to continue configuration

Set up cron

Create a new course