Configuration file - MoodleDocs (2024)

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

Contents

  • 1 config-dist.php
  • 2 Setting $CFG->wwwroot correctly
  • 3 Enabling password salting
  • 4 Including passwords in backups
  • 5 Changing default block layout for new courses
  • 6 Adding extra theme directory location
  • 7 Disabling update notifications
  • 8 Enabling debugging
  • 9 Forcing the value of admin settings
  • 10 See also

config-dist.php

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.

Setting $CFG->wwwroot correctly

This setting must be a fixed URL (a string constant) that points to your site. Do not try to set this with any PHP code that can generate a variable URL. This is not supported, can cause strange problems and will stop command line scripts working completely. If your site is accessed from different IP addresses this should be done with a split DNS, see Masquerading

If you change your site from http to https, you MUST update this setting. If you don't, you will have problems - for example (but not limited to) CSS and JavaScript won't load properly and you will also experience problems with logging in to your site. Also see Transitioning to HTTPS

Enabling password salting

See Password salting.

Including passwords in backups

Hashed user passwords are no longer saved in backup files containing user data.

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:

$CFG->includeuserpasswordsinbackup = true;

Note regarding restoring Moodle 2.5 backups to sites with old PHP versions:

Because bcrypt is not supported in PHP versions below 5.3.7, course backups made using the $CFG->includeuserpasswordsinbackup setting on a site using PHP version 5.3.7+ that are subsequently restored to a site with PHP version < 5.3.7 will require a password reset.

Changing default block layout for new courses

See Block layout.

Adding extra theme directory location

It is possible to add an extra themes directory stored outside of $CFG->dirroot. This local directory does not have to be accessible from internet. Themes 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 extra themes in a subdirectory called 'my_moodle_themes', your config.php might look like this:

$CFG->wwwroot = 'http://my.moodle.site.edu';$CFG->dirroot = '/var/www/my.moodle.site.edu/public_html';$CFG->themedir = $CFG->dirroot . '/my_moodle_themes';

Disabling update notifications

See Notifications.

Enabling debugging

See Debugging.

Forcing the value of admin settings

As explained in config-dist.php, it is possible to specify normal admin settings here, the point is that they can not be changed through the standard admin settings pages any more. Just set the value in config.php like:

$CFG->showuseridentity = 'email,idnumber,username';$CFG->preventexecpath = true;$CFG->pathtodu = "/usr/bin/du";$CFG->pathtodot = "/usr/bin/dot";$CFG->pathtogs = "/usr/bin/gs";

Configuration for plugins can also be forced by the syntax is different, e.g. continuing the example above for security to always hard coded paths to all executable files:

$CFG->forced_plugin_settings['filter_tex']['pathconvert'] = '/usr/bin/convert';$CFG->forced_plugin_settings['filter_tex']['pathdvips'] = '/usr/bin/dvips';$CFG->forced_plugin_settings['filter_tex']['pathdvisvgm'] = '/usr/bin/dvisvgm';$CFG->forced_plugin_settings['filter_tex']['pathlatex'] = '/usr/bin/latex';

See also

Configuration file - MoodleDocs (2024)

FAQs

Where is the configuration file in Moodle? ›

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.

Where is config.php located? ›

wp-config. php is one of the most important files in your WordPress installation. This file contains your website's configuration details and is located in the root of your WordPress file directory.

What is a config.php file? ›

The config. php file, located in your /global folder contains the unique settings for your Form Tools installation: your database connection settings, root folder and URLs and other information. This file is the only file in the script that should be customized.

How to configure Moodle? ›

How to Install Moodle LMS For Windows
  1. Plan System Capacity. ...
  2. Install Database Server. ...
  3. Install Web Server. ...
  4. Install PHP. ...
  5. Download Moodle & Copy Files into Place. ...
  6. Create Moodle Data Directory & Secure Database. ...
  7. Begin Moodle Install. ...
  8. Setup Backups.

Where are the Moodle files stored? ›

Moodle stores files in the Moodle data directory. This is a location on your server defined by you when you install Moodle. You can check the location of that directory in the Moodle config.

What file type is configuration settings? ›

A file with the . CFG or . CONFIG file extension is a configuration file used by various programs to store settings that are specific to their respective software. Some configuration files are plain text files, but others might be stored in a format specific to the program.

How to check configuration file in php? ›

How to check PHP version and configuration
  1. Log into your cPanel account, go to the Files section > File Manager:
  2. Navigate to the public_html directory, click on +File and create a phpinfo.php file:
  3. Find the newly created file in the list and click on Edit in the upper corner menu or right-click on the file > Edit:

How to change php configuration file? ›

When running PHP on Windows, the configuration values can be modified on a per-directory basis using the Windows registry. The configuration values are stored in the registry key HKLM\SOFTWARE\PHP\Per Directory Values , in the sub-keys corresponding to the path names.

Where is my web config file located? ›

The Web. Config file is used to configure Oracle Web Application functionality. This file is typically installed in the c:\Inetput\wwwroot\WebApp directory.

How to open PHP configuration? ›

View PHP settings with phpinfo Function

You often need to check PHP settings during web development. You can do this by running a script that calls the phpinfo() function. When you load the page in a web browser, the script shows all of the PHP configuration settings for your web site.

What is $cfg in Moodle? ›

Re: what is $CFG?!

It is not a table, it is a structure that is created from your config. php file when you accessing moodle. You can reach the elements like it is set in config. php, e.g. you need your wwwroot to concat with your relative path, so you write $CFG->wwwroot. '1.

How to use a PHP config file? ›

php file.
  1. Code 1: Create a PHP file and save it with the name 'config. php'. <? php. $host = 'localhost' ; ...
  2. Code 2: Create a PHP file and save it with the name 'try. php' in the same folder as 'config. php' file. Copy the below code to include the 'config. ...
  3. Output:
Mar 2, 2020

How do I set the main file in Moodle? ›

Click on the index. html file or the file you want to start displaying your linked files from then in the popup dialogue click the button 'Set main file'. This ensures this file is the one that appears on the course page for students to click on. The main file is then indicated with a title in bold.

How do I force login to Moodle? ›

The answer is Yes and it is actually really easy to do in Moodle.
  1. Log into your Moodle site as an admin user, and navigate to the Site security settings option by going to Site administration > Security > Site security settings.
  2. Tick the “Force users to login” option checkbox.
  3. Click the “Save changes” button.
Jun 12, 2023

Where is the Web configuration file? ›

To find your website's configuration file, open the file manager and head to the public_html folder of your website. Most configuration files are located there, as it is the root directory of a website.

How do I configure backups in Moodle? ›

To set the backup schedule:
  • Go to Settings > Site administration > > Courses > Backups > Automated backup setup.
  • Set backup_auto_active to enabled.
  • Select the days of the week to run the backup.
  • Set the execution time for the backup process. ...
  • Set the "Save to..." path.

Where is activity settings in Moodle? ›

From Administration > Site administration > Plugins > Activity modules > Manage activities, the administrator can view a list of activities and manage their settings.

How do I use configurable reports in Moodle? ›

Setting up the General Settings for your Custom Report
  1. Log into the Moodle Dashboard.
  2. Go to the Configurable Blocks block. Note! ...
  3. Initially there will be No Reports available. Click Add Report.
  4. Enter the name of the Report and the Summary. In the Type of Report, you can select the following types for reports.
Aug 16, 2021

Top Articles
Latest Posts
Article information

Author: Domingo Moore

Last Updated:

Views: 6460

Rating: 4.2 / 5 (53 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Domingo Moore

Birthday: 1997-05-20

Address: 6485 Kohler Route, Antonioton, VT 77375-0299

Phone: +3213869077934

Job: Sales Analyst

Hobby: Kayaking, Roller skating, Cabaret, Rugby, Homebrewing, Creative writing, amateur radio

Introduction: My name is Domingo Moore, I am a attractive, gorgeous, funny, jolly, spotless, nice, fantastic person who loves writing and wants to share my knowledge and understanding with you.