Configuration file

Revision as of 15:22, 24 May 2012 by Helen Foster (talk | contribs) (copying changes from 21 wiki)

Jump to: navigation, search

The name for Moodle's configuration file is config.php. The file is located in the moodle directory. It is not included in the Moodle download packages and is created by the installation process from the template file config-dist.php (which is included in Moodle packages).


Although the installation process creates the config.php file for you, there may be times when you want to do this yourself. A sample config file, called config-dist.php, is shipped with Moodle.

To get started simply copy config-dist.php to config.php, then edit config.php with you favourite editor. The file is very well commented. The important options (which you must supply) are all nearer the top. Other less common options are further down.

Enabling password salting

See Password salting.

Including passwords in backups

Hashed user passwords are no longer saved in backup files containing user data in Moodle 1.8.11 and 1.9.7 onwards.

If you really need passwords to be saved (in the rare case of restoring a backup with user data to a different site), the following line may be added to config.php:


Changing default block layout for new courses

See Block layout.

Changing default theme directory location

The location of theme directorys may be altered, using the variables $CFG->themewww and $CFG->themedir. Themes from placed in the directory specified by these variables will then be available for selection using the theme selector.

For example, should you wish to place themes in a subdirectory called 'my_moodle_themes', your config.php might look like this:

$CFG->wwwroot   = '';
$CFG->dirroot   = '/var/www/';
$CFG->themewww  = $CFG->wwwroot . '/my_moodle_themes';
$CFG->themedir  = $CFG->dirroot . '/my_moodle_themes';

See also