Configuration Reference: System Settings
These parameters are listed in the order in which they appear by default in config.php
.
Compulsory Parameters
$CFG->dbtype (String)
The database system that is used, MySQL is the default. For all other values such as postgres7 or oci8po, check the values given during the database setup in the installer.
$CFG->dbhost (String)
The name of the database host: localhost or 127.0.0.1 if the database is located on the server as Moodle, or any other URL (resolved or unresolved) if located on another server.
$CFG->dbname (String)
The name of the database.
$CFG->dbuser (String)
The username of the database account.
$CFG->dbpass (String)
The password of the database account.
$CFG->dbpersist (Binary)
This specifies whether an existing database connection should be reused. This can improve performance, but is potentially less stable.
$CFG->prefix (String)
By default, all tables in Moodle are prefixed with mdl_
. This should be changed only if you run multiple Moodle installations using the same database.
$CFG->wwwroot (String)
This is the full web address (including http://)
where Moodle has been installed.
$CFG->dirroot (String)
This is the absolute directory name where Moodle has been installed.
$CFG->dataroot (String)
This is the absolute directory name where Moodle's data dictionary is located. The directory has to be readable and writable, but must not be accessible via the Web.
$CFG->admin (String)
The admin pages in Moodle are located in the admin directory. If this has to be changed then specify the new directory here as some ISPs don't allow its usage because it conflicts with their internal setup.
$CFG->directorypermissions (Special)
These are the permissions in Unix format that are applied for directories Moodle is creating. Default is 00777.
Optional Parameters
There exist a significant number of parameters that are neither set by the installer, nor can be modified via the Moodle administrator interface. These optional parameters allow you to modify the behavior of Moodle. Explanations have been taken from the dedicated configuration page at http://docs.moodle.org/en/Configuration_file. The parameters have been listed in alphabetical order.
$CFG->admineditalways (Binary)
Setting this to true will enable administrators to edit any post at any time.
$CFG->allowvisiblecoursesinhiddencategories
Restore pre-1.6 behavior where courses could still be available even if the category they were in was hidden.
$CFG->apacheloguser (Menu)
The setting will turn on username logging into Apache log. Accepted values are 0 (feature turned off), 1 (log user ID), 2 (log full name), and 3 (log username).
$CFG->dblogerror (Binary)
The setting will turn SQL Error logging on. This will output an entry in Apache error log indicating the position of the error and the statement called. This option will surely take action disregarding the error_reporting
setting.
$CFG-> bounceratio (Numeric)
Refer $CFG->handlebounces.
$CFG->customscripts (String)
Enabling this will allow custom scripts to replace existing Moodle scripts. For example, if $CFG->customscripts/course/view.php
exists then it will be used instead of $CFG->wwwroot/course/view.php
. At present, this will only work for files that include config.php
and are called as part of the URL (index.php is implied). Custom scripts should not include config.php
.
Tip
Warning: Replacing standard Moodle scripts may pose security risks, and/or may not be compatible with upgrades. Use this option only if you are aware of the risks involved. Specify the full directory path to the custom scripts.
$CFG->docroot (String)
By default, Moodle documentation is provided via the MoodleDocs at http://docs.moodle.org. If you wish to replace the documentation with your own, you will have to change the link to the homepage of your alternative documentation. Bear in mind that the directory structure and file naming has to be identical to the default documentation.
$CFG->defaultblocks (Array)
These blocks are used when no other default setting for blocks is found. Accepted values are: participants, activity_modules, search_forums, admin, course_list, news_items, calendar_upcoming, and recent_activity.
$CFG->defaultblocks_override (Array)
If this parameter is set, it overrides all other DEFAULT block variables and is the only one used. Array values are: participants, activity_modules, search_forums, admin, course_list, news_items, calendar_upcoming, and recent_activity.
These following variables define the specific settings for defined course formats. They override any settings defined in the format's config
file:
$CFG->defaultblocks_site (Array)
Accepted values are: site_main_menu, admin, course_list, course_summary, and calendar_month.
$CFG->defaultblocks_social (Array)
Accepted values are: participants, search_forums, calendar_month, calendar_upcoming, social_activities, recent_activity, admin, and course_list.
$CFG->defaultblocks_topics (Array)
Accepted values are: participants, activity_modules, search_forums, admin, course_list, news_items, calendar_upcoming, and recent_activity.
$CFG->defaultblocks_weeks (Array)
Accepted values are: participants, activity_modules, search_forums, admin, course_list, news_items, calendar_upcoming, and recent_activity.
$CFG->disablemycourses (Binary)
This setting will prevent the My Courses page from being displayed when a student logs in. The site's front page will always show the same (logged out) view.
$CFG->disablescheduledbackups (Binary)
Prevent scheduled backups from operating (and hide the GUI for them). This is useful for webhost operators who have alternate methods of backups.
$CFG->disablestatsprocessing (Binary)
Prevent stats processing and hide the GUI.
$CFG->emailconnectionerrorsto (String)
Email database connection errors to someone. If Moodle cannot connect to the database, then email this address with a notice.
$CFG->filelifetime (Numeric)
Time in seconds for files to remain in caches (default is 86400, which equals 24 hours). Decrease this if you are worried about students being served outdated versions of uploaded files.
$CFG->forcefirstname (String)
Use this to anonymize usernames for all students. If set, then all non-teachers will always see this for every person.
$CFG->forcelastname (String)
To anonymize usernames for all students. If set, then all non-teachers will always see this for every person.
$CFG->handlebounces (Binary)
This is for handling email bounces. It should be used in conjunction with $CFG->minbounces
(Numeric, default 10) and $CFG->bounceratio
(Numeric, default 20). Also check $CFG->mailprefix, $CFG->mailprefix
and $CFG->maildomain
.
$CFG->mailprefix (String)
mdl+
is the separator for Exim and Postfix, mdl-
is the separator for qmail.
$CFG->maildomain (String)
Indicates your email domain.
$CFG->loginaspassword (Password)
Set global password for login as teacher is prompted only once in each session. Set your own password and tell it only to teachers who should have access to this feature.
$CFG->minbounces (Numeric)
Refer $CFG->handlebounces.
$CFG->nofixday (Binary)
This setting will cause the userdate()
function not to fix %d
in date strings, and just let them show with a zero prefix.
$CFG->preferlinegraphs (Binary)
This setting will make some graphs (for example, user logs). Preferably, use lines instead of bars.
$CFG->respectsessionsettings (Binary)
The setting will tell Moodle to respect your PHP session settings. Use this if you want to control session configuration from php.ini, httpd.conf
, or .htaccess
files.
$CFG->tracksessionip (Binary)
If this setting is set to true, then Moodle will track the IP of the current user to make sure it hasn't changed during a session. This will prevent the possibility of sessions being hijacked via XSS. But it may break things for users logging in with proxies that change all the time such as AOL.
$CFG->unicodedb (Binary)
This setting will put Moodle in Unicode mode. Please note that your database must support it. Do not enable this if your database is not converted to UTF-8.
$CFG->unicodecleanfilename (Binary)
Allow Unicode characters in uploaded files, generated reports, and so on. This setting is new and not much tested. There are known problems with backup/restore that will not be solved because native infozip binaries are doing some weird conversions; use internal PHP zipping instead.
Note
Please note that this is not recommended for production sites.