<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/39/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lameze</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/39/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lameze"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/Special:Contributions/Lameze"/>
	<updated>2026-05-15T19:01:45Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Universal_Office_Converter_(unoconv)&amp;diff=124304</id>
		<title>Universal Office Converter (unoconv)</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Universal_Office_Converter_(unoconv)&amp;diff=124304"/>
		<updated>2016-07-15T04:56:24Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* Installing unoconv on Windows */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Environment}}&lt;br /&gt;
==What is unoconv?==&lt;br /&gt;
&lt;br /&gt;
&amp;quot;unoconv&amp;quot; is a command line program that is used to convert between different office document file formats. It uses an instance of [http://libreoffice.org LibreOffice] to do the conversion and is used by the [[Assignment activity]] to convert documents to pdf so that they can be annotated. If unoconv is not installed - the only impact is that the assignment activities will only allow annotations when students upload a pdf document. &lt;br /&gt;
&lt;br /&gt;
The steps required to install unoconv are different depending on the operating system that you have installed Moodle on. &lt;br /&gt;
&lt;br /&gt;
== Installing unoconv on Linux ==&lt;br /&gt;
The required version of unoconv is at least 0.7. Depending on your flavour of linux, this may be available in your package manager and you can install it directly with:&lt;br /&gt;
&lt;br /&gt;
===Ubuntu 16.04 LTS===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install unoconv&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your package manager contains an older version of the package, you will have to find a newer version and install it manually ([https://packages.debian.org/stretch/unoconv Debian Testing]). Unoconv itself is just a python script, so it has few dependencies.&lt;br /&gt;
&lt;br /&gt;
Potential problems:&lt;br /&gt;
* On some systems the apache user home directory is set to a non existent folder. This can cause unoconv to fail. There are 2 solutions to this - one is to make a (writable) home directory for the apache user (like /home/www-data). The other is to run a unoconv listener (described below) as another user other than the apache user (someone with a valid, writable home directory).&lt;br /&gt;
* If you are still running 14.04LTS then unoconv won&#039;t work as shipped. This might not be the most efficient route but it worked by first installing unoconv (version 0.6) from the package manager as above. You will then need to grab unoconv 0.7 from Github (https://github.com/dagwieers/unoconv), then upgrade to the latest libreoffice using the PPA (https://launchpad.net/~libreoffice/+archive/ubuntu/ppa). Point moodle at the Github version of unoconv. You need to modify the Python unoconv file by changing &#039;python&#039; in the first line to &#039;python3&#039;. You also need to change the permissions on the directory /var/www so that the user www-data can write to it (www-data needs to write to its home directory which it cannot do by default).&lt;br /&gt;
&lt;br /&gt;
===CentOS / RedHat===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
yum install openoffice*&lt;br /&gt;
yum install libreoffice-pyuno&lt;br /&gt;
git clone https://github.com/dagwieers/unoconv.git&lt;br /&gt;
cd unoconv&lt;br /&gt;
# copy &lt;br /&gt;
cp unoconv /usr/bin&lt;br /&gt;
# or link unoconv to /usr/bin&lt;br /&gt;
ln -s ./unoconv /usr/bin/unoconv&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make sure it is properly configured:&lt;br /&gt;
http://your-moodle/admin/search.php?query=unoconv&lt;br /&gt;
&lt;br /&gt;
== Installing unoconv on OS X ==&lt;br /&gt;
Download and install LibreOffice for Mac. Unfortunately - newer versions of LibreOffice are not currently compatible with unoconv for mac and you will have to install LibreOffice 4.2 (Direct download link - https://downloadarchive.documentfoundation.org/libreoffice/old/4.2.5.2/mac/x86_64/LibreOffice_4.2.5.2_MacOS_x86-64.dmg).&lt;br /&gt;
&lt;br /&gt;
Get the latest version of the unoconv python script. One way to do this is with http://brew.sh/ brew.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
brew install unoconv&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you haven&#039;t done it already - install ghostscript. One way to install ghostscript is also with http://brew.sh/ brew&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
brew install ghostscript&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set the paths to unoconv and ghostscript in Moodle (&#039;&#039;Site administration &amp;gt; Server &amp;gt; System paths&#039;&#039;). If you used brew, they will both be installed to /usr/local/bin.&lt;br /&gt;
&lt;br /&gt;
LibreOffice needs write access to the current users home directory to create some temporary files. When unoconv is run as the webserver user (_www) it does not normally have this permission.&lt;br /&gt;
&lt;br /&gt;
There are some ways to get around this - one way is just to give the &amp;quot;_www&amp;quot; user write access to /Library/WebServer. &lt;br /&gt;
&lt;br /&gt;
Another solution is to convince LibreOffice that this users home directory is somewhere else. This can be done by inserting this code into the top of the unoconv python script.&lt;br /&gt;
Code to insert:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Set home to a writable folder. &lt;br /&gt;
os.environ[&#039;HOME&#039;] = &#039;/tmp/&#039;                                                                                                        &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This needs to be inserted at line 36 immediately after the line &amp;quot;exitcode = 0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Installing unoconv on Windows ==&lt;br /&gt;
Download and install LibreOffice for windows.&lt;br /&gt;
&lt;br /&gt;
Download the latest version of the unoconv script from https://github.com/dagwieers/unoconv/releases (download the zip version). &lt;br /&gt;
&lt;br /&gt;
From the downloaded zip file - extract the one file &amp;quot;unoconv-0.7\unoconv&amp;quot; (no file extension). This is the unoconv script - none of the other files in the package are required. &lt;br /&gt;
&lt;br /&gt;
Rename the downloaded script to C:\unoconv\unoconv.py&lt;br /&gt;
&lt;br /&gt;
Create a batch file C:\unoconv\unoconv.bat with these contents:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@&amp;quot;C:\Program Files\LibreOffice 5\program\python.exe&amp;quot; c:\unoconv\unoconv.py %*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set paths in Moodle. &lt;br /&gt;
&lt;br /&gt;
Login as admin and go to &#039;&#039;Site administration &amp;gt; Server &amp;gt; System paths&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Set pathtogs setting to your ghostscript installation binary, (C:\gs\bin\gswin32.exe)&lt;br /&gt;
&lt;br /&gt;
Set pathtounoconv to the batch file created above (C:\unoconv\unoconv.bat)&lt;br /&gt;
&lt;br /&gt;
Test ghostscript and unoconv are working correctly in the admin test pages &amp;quot;Site administration &amp;gt; Plugins &amp;gt; Activity modules &amp;gt; Assignment &amp;gt; Feedback plugins &amp;gt; Annotate PDF&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Run a unoconv listener ==&lt;br /&gt;
Unoconv utilises a client/server process when converting documents. By default, when there is no running server process - each time unoconv runs it will start a server process, send its request and shut down the server process when the request is complete. The drawback of this mode is that if 2 requests are submitted simultaneously - this can cause the first request to shutdown the server process when the second request is still in progress - and the second conversion request fails. A more robust way to configure unoconv is to start a server process at boot time, and/or run a script to monitor it and restart it if it crashes.&lt;br /&gt;
&lt;br /&gt;
To start a unoconv listener at boot time - you need a start up script. Different operating systems and Linux distributions use different startup scripts - but here are some examples of startup scripts for different systems.&lt;br /&gt;
&lt;br /&gt;
[[mod/assign/feedback/editpdf/testunoconv/upstart | Upstart script for Ubuntu based systems]]&lt;br /&gt;
&lt;br /&gt;
[[mod/assign/feedback/editpdf/testunoconv/launchd | Launchd script for OS X]]&lt;br /&gt;
&lt;br /&gt;
[[mod/assign/feedback/editpdf/testunoconv/initd | Init script for Debian]]&lt;br /&gt;
&lt;br /&gt;
== Offload processing to a different server ==&lt;br /&gt;
Processing office documents can put increased load on your webserver, which may impact on the responsiveness of your site. If you are installing unoconv on a large site you may want to consider running unoconv on a server that is not also serving web requests.&lt;br /&gt;
&lt;br /&gt;
How to do this:&lt;br /&gt;
&lt;br /&gt;
Install unoconv on each webservers and the remote server following the installation instructions above. &lt;br /&gt;
&lt;br /&gt;
Make sure unoconv is started at boot time on the remote server with the &amp;quot;--listener&amp;quot; argument and is monitored and restarted if it exits (see Debian init script for an example of how to do this). &lt;br /&gt;
&lt;br /&gt;
Open the firewall port 2002 between the moodle webservers and the machine running unoconv.&lt;br /&gt;
&lt;br /&gt;
Share the moodle data root between the webservers and the machine running unoconv. This folder must be mounted at the same path on all servers. &lt;br /&gt;
&lt;br /&gt;
Install a wrapper for unoconv on the webservers that forwards the requests to the remote server. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Wrapper script for unoconv to forward processing.&lt;br /&gt;
# Install to /usr/bin/unoconv-remote with 755 permissions&lt;br /&gt;
/usr/bin/unoconv --server=&amp;lt;ip of remote server&amp;gt; &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure the path to unoconv in the Moodle admin settings to point to this wrapper script.&lt;br /&gt;
&lt;br /&gt;
==Additional resources==&lt;br /&gt;
The unoconv [https://github.com/dagwieers/unoconv documentation] site has additional information on installation of unoconv and troubleshooting tips.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=335310 Is the unoconv installation a security risk?] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[Category:Site administration]]&lt;br /&gt;
[[Category:Assignment]]&lt;br /&gt;
&lt;br /&gt;
[[es:mod/assign/feedback/editpdf/testunoconv]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=PHP&amp;diff=122690</id>
		<title>PHP</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=PHP&amp;diff=122690"/>
		<updated>2016-03-29T02:15:21Z</updated>

		<summary type="html">&lt;p&gt;Lameze: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
PHP is the scripting language in which Moodle is developed. It is integrated with your web server. The web server detects php pages (by their extension) and sends them to PHP for execution. PHP must be installed and configured properly for Moodle to work effectively (or at all). &lt;br /&gt;
&lt;br /&gt;
==PHP Settings==&lt;br /&gt;
Check these settings in your php.ini or .htaccess file (if you&#039;re using Apache). For settings which use ON/OFF as their values, you can substitute 1 for ON and 0 for OFF if you prefer. If you change php.ini, don&#039;t forget to restart the server. &lt;br /&gt;
* &#039;&#039;register_globals&#039;&#039; &#039;&#039;&#039;MUST&#039;&#039;&#039; be OFF - (Feature removed as of PHP 5.4. PHP 5.4 is a minimum requirement of Moodle 2.7)&lt;br /&gt;
* &#039;&#039;safe_mode&#039;&#039; needs to be OFF - (Feature removed as of PHP 5.4. PHP 5.4 is a minimum requirement of Moodle 2.7)&lt;br /&gt;
* &#039;&#039;memory_limit&#039;&#039; should be at least 64M (although some functions may not work if this low). 128M is recommended. Large systems may need an even higher setting.&lt;br /&gt;
* &#039;&#039;session.save_handler&#039;&#039; needs to be set to FILES.&lt;br /&gt;
* &#039;&#039;magic_quotes_gpc&#039;&#039; should be OFF - (Feature removed as of PHP 5.4. PHP 5.4 is a minimum requirement of Moodle 2.7)&lt;br /&gt;
* &#039;&#039;magic_quotes_runtime&#039;&#039; needs to be OFF.&lt;br /&gt;
* &#039;&#039;file_uploads&#039;&#039; needs to be ON.&lt;br /&gt;
* &#039;&#039;session.auto_start&#039;&#039; needs to be OFF.&lt;br /&gt;
* &#039;&#039;session.bug_compat_warn&#039;&#039; needs to be OFF - (Feature removed as of PHP 5.4. PHP 5.4 is a minimum requirement of Moodle 2.7)&lt;br /&gt;
* The temp folder must be defined and writeable by your webserver user&lt;br /&gt;
* Check the error display/logging section. Make sure the settings are appropriate for your server use.&lt;br /&gt;
* &#039;&#039;post_max_size&#039;&#039; and &#039;&#039;upload_max_filesize&#039;&#039; restrict the maximum file size that can be uploaded.&lt;br /&gt;
* Check the &#039;&#039;[mail function]&#039;&#039; and database section (for your chosen database) to make sure they match your server configuration.&lt;br /&gt;
&lt;br /&gt;
==HTTP_RAW_POST_DATA errors==&lt;br /&gt;
Some users are experiencing $HTTP_RAW_POST_DATA related errors, when establishing connection between MNET servers or making AJAX web services requests.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Request for server name returned empty response&lt;br /&gt;
 &lt;br /&gt;
    line 134 of /mnet/lib.php: call to debugging()&lt;br /&gt;
    line 115 of /admin/mnet/peers.php: call to mnet_get_public_key()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These errors are affecting users running moodle on PHP 5.6 version and it&#039;s a PHP bug on the &#039;&#039;&#039;always_populate_raw_post_data&#039;&#039;&#039; setting the default value to 0.&lt;br /&gt;
&lt;br /&gt;
To avoid the error messages above, please change the value following setting on your php.in:&lt;br /&gt;
* &#039;&#039;&#039;always_populate_raw_post_data&#039;&#039;&#039; should be changed to &#039;&#039;&#039;-1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
For more information about this bug, see: https://bugs.php.net/bug.php?id=66763&lt;br /&gt;
&lt;br /&gt;
==Finding the correct php.ini==&lt;br /&gt;
Sometimes it is not obvious where the php.ini file is located or you may even find more than one. To be certain run &#039;phpinfo&#039; - see below. The path of the php.ini file is a few lines down in the top section. &lt;br /&gt;
&lt;br /&gt;
Note that if you are using command-line (CLI) PHP for running cron (or anything else) it may be configured with a &#039;&#039;different&#039;&#039; php.ini file.  To check, run the following command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
php -i | grep php.ini&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==PHP Extensions and libraries==&lt;br /&gt;
The following PHP extensions are required or recommended (some, e.g. iconv, ctype and tokenizer are now included in PHP by default). Others will need to be installed or selected.&lt;br /&gt;
* The &#039;&#039;&#039;iconv&#039;&#039;&#039; extension is required.&lt;br /&gt;
* The &#039;&#039;&#039;mbstring&#039;&#039;&#039; extension is recommended.&lt;br /&gt;
* The &#039;&#039;&#039;curl&#039;&#039;&#039; extension is required (required for networking and web services).&lt;br /&gt;
* The &#039;&#039;&#039;openssl&#039;&#039;&#039; extension is recommended (required for networking and web services).&lt;br /&gt;
* The &#039;&#039;&#039;tokenizer&#039;&#039;&#039; extension is recommended.&lt;br /&gt;
* The &#039;&#039;&#039;xmlrpc&#039;&#039;&#039; extension is recommended (required for networking and web services).&lt;br /&gt;
* The &#039;&#039;&#039;soap&#039;&#039;&#039; extension is recommended (required for web services).&lt;br /&gt;
* The &#039;&#039;&#039;ctype&#039;&#039;&#039; extension is required.&lt;br /&gt;
* The &#039;&#039;&#039;zip&#039;&#039;&#039; extension is required.&lt;br /&gt;
* The &#039;&#039;&#039;gd&#039;&#039;&#039; extension is recommended (required for manipulating images).&lt;br /&gt;
* The &#039;&#039;&#039;simplexml&#039;&#039;&#039; extension is required.&lt;br /&gt;
* The &#039;&#039;&#039;spl&#039;&#039;&#039; extension is required.&lt;br /&gt;
* The &#039;&#039;&#039;pcre&#039;&#039;&#039; extension is required.&lt;br /&gt;
* The &#039;&#039;&#039;dom&#039;&#039;&#039; extension is required.&lt;br /&gt;
* The &#039;&#039;&#039;xml&#039;&#039;&#039; extension is required.&lt;br /&gt;
* The &#039;&#039;&#039;intl&#039;&#039;&#039; extension is recommended.&lt;br /&gt;
* The &#039;&#039;&#039;json&#039;&#039;&#039; extension is required.&lt;br /&gt;
* &#039;&#039;&#039;The appropriate extension for your chosen database is also required.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).&lt;br /&gt;
&lt;br /&gt;
==Installing (missing) extensions==&lt;br /&gt;
&lt;br /&gt;
This depends on how PHP was installed on your machine and what access you have. Here are some possibilities:&lt;br /&gt;
* If this is a hosted server you are likely to have to ask the administrator or hosting company. &lt;br /&gt;
* If PHP was compiled from source you will need to recompile, changing the &#039;configure&#039; settings - see [[Compiling PHP from source]].&lt;br /&gt;
* If it was installed using packages (typically Linux) you can install the required package (see your Linux distribution&#039;s documentation)&lt;br /&gt;
* If you are using Windows you just need to uncomment the appropriate DLL files in php.ini&lt;br /&gt;
&lt;br /&gt;
After making any changes or additions, don&#039;t forget to re-start your web server.&lt;br /&gt;
&lt;br /&gt;
== .htaccess files ==&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have access to the php.ini file or there are conflicting requirements with other PHP applications on the same server you may be able to change PHP settings in an .htaccess file. This should be placed in the &#039;root&#039; of your Moodle installation (i.e. the same place as the config.php file). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The file isn&#039;t always called .htaccess and may not work at all. Contact your server administrator to be sure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Settings are made by adding lines in one of two formats:&lt;br /&gt;
* php_value &#039;&#039;name value&#039;&#039;&lt;br /&gt;
* php_flag &#039;&#039;name on/off&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
* &#039;&#039;&#039;php_value memory_limit 128M&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;php_flag register_globals off&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==PHP info==&lt;br /&gt;
&lt;br /&gt;
The phpinfo display contains information about the configuration of your PHP installation. This is useful for checking:&lt;br /&gt;
* that your PHP installation meets Moodle&#039;s system requirements.&lt;br /&gt;
* the values that are currently applied to your server&#039;s PHP install, e.g. File upload limits&lt;br /&gt;
* that you have installed the required modules needed for Moodle to work, e.g. the LDAP module for LDAP authentication.&lt;br /&gt;
&lt;br /&gt;
=== Displaying phpinfo in Moodle===&lt;br /&gt;
&lt;br /&gt;
An administrator can find PHP info in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Server &amp;gt; PHP info&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Displaying phpinfo outside of Moodle ===&lt;br /&gt;
&lt;br /&gt;
To view the phpinfo information:&lt;br /&gt;
* Create a file called info.php using your text editor, containing this single line:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code php&amp;gt;&lt;br /&gt;
 &amp;lt;?php phpinfo(); ?&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Save this file as info.php&lt;br /&gt;
* Upload this file into the root web accessible folder on your server.&lt;br /&gt;
* Now open this file in your browser. For example &amp;lt;nowiki&amp;gt;http://&amp;lt;server-name&amp;gt;/info.php&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Compiling PHP from source]]&lt;br /&gt;
* [https://docs.moodle.org/dev/Moodle_and_PHP7 Moodle and PHP7] in the developers documentation&lt;br /&gt;
*http://www.php.net/ - the PHP web site&lt;br /&gt;
*http://php.iis.net/ - Microsoft PHP Installer for IIS&lt;br /&gt;
&lt;br /&gt;
[[de:PHP-Versionen für Moodle]]&lt;br /&gt;
[[es:PHP]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=CAS_server_(SSO)_authentication&amp;diff=120981</id>
		<title>CAS server (SSO) authentication</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=CAS_server_(SSO)_authentication&amp;diff=120981"/>
		<updated>2015-11-03T07:00:16Z</updated>

		<summary type="html">&lt;p&gt;Lameze: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
Location: Settings link in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage authentication&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
CAS is &amp;quot;Single Sign-on for the Web&amp;quot; and is developed by [http://www.ja-sig.org/products/cas/ JA-SIG] in an open-source, collaborative manner.  CAS is very beneficial in environments where a number of different web applications share a set of common users.  If all the web applications were &amp;lt;em&amp;gt;&amp;quot;CASified&amp;quot;&amp;lt;/em&amp;gt; a user would log in once and would then be able to move between the various web applications without ever having to present authentication credentials again.  CAS is similar to the [[Shibboleth]] authentication mechanism, but it is vastly simpler to set up and lacks a number of broader features like federated trust and authorization infrastructure.&lt;br /&gt;
&lt;br /&gt;
The details for how CAS works are [http://www.jasig.org/cas/cas2-architecture well documented], but CAS essentially works by configuring a web application (moodle.example.com) to not do authentication itself, but to instead forward unauthenticated users to a &amp;lt;em&amp;gt;&amp;quot;CAS Server&amp;quot;&amp;lt;/em&amp;gt; (cas.example.com) which will then return an authentication token to the original web application (moodle.example.com).  Moodle can extract the username from the token and then use its internal authorization mechanisms (roles, enrollments, capabilities) and user attributes (name, picture, etc.).  The advantage is that the moodle.example.com service never has to handle passwords and that users, once they&#039;ve authenticated the first time, can move seamlessly to another web application without having to present their credentials again.&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
Assuming that you already have a working CAS server, configuration is fairly straightforward through the web interface.  &lt;br /&gt;
&lt;br /&gt;
One caveat for those converting from LDAP or other authentication mechanisms:&lt;br /&gt;
&lt;br /&gt;
* For any user that you wish to authenticate with CAS but which already has been using Moodle, and thus has an entry in the Moodle database, you will need to change the value of the &amp;quot;auth&amp;quot; field for the user in the mdl_user table.  So, if they used LDAP before, but now you wish for them to use CAS and their username is &amp;quot;foobar&amp;quot; you&#039;ll need to edit the database with some SQL something like: &amp;lt;code&amp;gt;UPDATE mdl_user SET auth=&#039;cas&#039; where auth=&#039;ldap&#039; and username=&#039;foobar&#039;;&amp;lt;/code&amp;gt;  Without this change the user will constantly be presented with a failed login message, but otherwise no clue as to why login failed even though their credentials were accepted by the CAS server.&lt;br /&gt;
&lt;br /&gt;
===Setting up regular automatic synchronisation using schedule task===&lt;br /&gt;
There is a default scheduled task to synchronize your moodle with a CAS server. The task &#039;&#039;&#039;CAS users sync job (\auth_cas\task\sync_task)&#039;&#039;&#039;  is responsible for create, update user information, suspend and delete all CAS accounts automatically. &lt;br /&gt;
The scheduled task can be enabled and configured on Site Administration &amp;gt; Server &amp;gt; Scheduled tasks by clicking on the gear icon. Select the desired frequency of running and enable the task, un-checking the Disabled checkbox.&lt;br /&gt;
It is important, however, to make sure that all of the above CAS settings are working properly before you try this, as well as backing up your database and moodledata folders. Poor CAS configuration could lead to users being wrongly deleted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[fr:Utiliser un serveur CAS (SSO)]]&lt;br /&gt;
[[de:CAS-Server]]&lt;br /&gt;
[[es:Servidor CAS (SSO)]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=LDAP_authentication&amp;diff=120980</id>
		<title>LDAP authentication</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=LDAP_authentication&amp;diff=120980"/>
		<updated>2015-11-03T06:19:23Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* Setting up regular automatic synchronisation using schedule task */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
Location: Settings link in &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage authentication&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This document describes how to set up Lightweight Directory Access Protocol (LDAP) authentication in Moodle.  We cover the basic, advanced and some trouble shooting sections to assist the user in the installation and administrating LDAP in Moodle.  &lt;br /&gt;
==Table of Contents==&lt;br /&gt;
__TOC__&lt;br /&gt;
==Basic Scenario==&lt;br /&gt;
The simple and straightforward approach  for most installations.&lt;br /&gt;
&lt;br /&gt;
===Assumptions===&lt;br /&gt;
&lt;br /&gt;
# Your Moodle site is located at &#039;&#039;&#039;http://your.moodle.site/&#039;&#039;&#039;&lt;br /&gt;
# You have configured your PHP installation with the LDAP extension. It is loaded and activated, and it shows when you go to &#039;&#039;&#039;http://your.moodle.site/admin/phpinfo.php&#039;&#039;&#039; (logged in as user &#039;admin&#039;).&lt;br /&gt;
# Your LDAP server has &#039;&#039;&#039;192.168.1.100&#039;&#039;&#039; as its IP address.&lt;br /&gt;
# You are not using LDAP with SSL (also known as LDAPS) in your settings. This might prevent certain operations from working (e.g., you cannot update data if you are using MS Active Directory -- MS-AD from here on --), but should be OK if you just want to authenticate your users.&lt;br /&gt;
# You don&#039;t want your users to change their passwords the first time they log in into Moodle.&lt;br /&gt;
# You are using a single domain as the source of your authentication data in case you are using MS-AD (more on this in the Appendices).&lt;br /&gt;
# You are using a top level distinguished name (DN) of &#039;&#039;&#039;dc=my,dc=organization,dc=domain&#039;&#039;&#039; as the root of your LDAP tree. &lt;br /&gt;
# You have a non-privileged LDAP user account you will use to bind to the LDAP server. This is not necessary with certain LDAP servers, but MS-AD requires this and it won&#039;t hurt if you use it even if your LDAP server doesn&#039;t need it. Make sure &#039;&#039;&#039;this account and its password don&#039;t expire&#039;&#039;&#039;, and make this password as strong as possible. Remember you only need to type this password once, when configuring Moodle, so don&#039;t be afraid of making it as hard to guess as possible. Let&#039;s say this user account has a DN of &#039;&#039;&#039;cn=ldap-user,dc=my,dc=organization,dc=domain&#039;&#039;&#039;, and password &#039;&#039;&#039;hardtoguesspassword&#039;&#039;&#039;.&lt;br /&gt;
# All of your Moodle users are in an organizational unit (OU) called &#039;&#039;&#039;moodleusers&#039;&#039;&#039;, which is right under your LDAP root. That OU has a DN of &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039;.&lt;br /&gt;
# You &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; want your LDAP users&#039; passwords to be stored in Moodle at all.&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
===Configuring Moodle authentication===&lt;br /&gt;
&lt;br /&gt;
Log in as an admin user and go to &#039;&#039;Administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage authentication&#039;&#039;. In the table that appears, enable the &amp;quot;LDAP Server&amp;quot; authentication option (click on the closed eye to make it open) and then click on the associated &#039;Settings&#039; link. You will get a page similar to this one:&lt;br /&gt;
&lt;br /&gt;
[[Image:LDAPserversettings.png|center]]&lt;br /&gt;
&lt;br /&gt;
Now, you just have to fill in the values. Let&#039;s go step by step.&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====LDAP Server Settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Host URL&lt;br /&gt;
| As the IP of your LDAP server is 192.168.1.100, type &amp;quot;&#039;&#039;&#039;ldap://192.168.1.100&#039;&#039;&#039;&amp;quot; (without the quotes), or just &amp;quot;&#039;&#039;&#039;192.168.1.100&#039;&#039;&#039;&amp;quot; (some people have trouble connecting with the first syntax, specially on MS Windows servers).&lt;br /&gt;
|-&lt;br /&gt;
| Version&lt;br /&gt;
| Unless you are using a really old LDAP server, &#039;&#039;&#039;version 3&#039;&#039;&#039; is the one you should choose.&lt;br /&gt;
|-&lt;br /&gt;
| LDAP Encoding&lt;br /&gt;
| Specify encoding used by LDAP server. Most probably utf-8.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Bind settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Don&#039;t cache passwords&lt;br /&gt;
| As you &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; want to store the users&#039;s password in Moodle&#039;s database, choose &#039;&#039;&#039;Yes&#039;&#039;&#039; here.&lt;br /&gt;
|-&lt;br /&gt;
| Distinguished Name&lt;br /&gt;
| This is the distinguished name of the bind user defined above. Just type &amp;quot;&#039;&#039;&#039;cn=ldap-user,dc=my,dc=organization,dc=domain&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|-&lt;br /&gt;
| Password&lt;br /&gt;
| This is the bind user password defined above. Type &amp;quot;&#039;&#039;&#039;hardtoguesspassword&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====User lookup settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| User type&lt;br /&gt;
| Choose: &lt;br /&gt;
* &#039;&#039;&#039;Novel Edirectory&#039;&#039;&#039; if your LDAP server is running Novell&#039;s eDdirectory.&lt;br /&gt;
* &#039;&#039;&#039;posixAccount (rfc2307)&#039;&#039;&#039; if your LDAP server is running a RFC-2307 compatible LDAP server (choose this is your server is running OpenLDAP, including Mac OS X server).&lt;br /&gt;
* &#039;&#039;&#039;posixAccount (rfc2307bis)&#039;&#039;&#039; if your LDAP server is running a RFC-2307bis compatible LDAP server.&lt;br /&gt;
* &#039;&#039;&#039;sambaSamAccount (v.3.0.7)&#039;&#039;&#039; if your LDAP server is running with SAMBA&#039;s 3.x LDAP schema extension and you want to use it.&lt;br /&gt;
* &#039;&#039;&#039;MS ActiveDirectory&#039;&#039;&#039; if your LDAP server is running Microsoft&#039;s Active Directory (MS-AD)&lt;br /&gt;
|-&lt;br /&gt;
| Contexts&lt;br /&gt;
| The DN of the context (container) where all of your Moodle users are found. Type &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; here.  &lt;br /&gt;
&lt;br /&gt;
On a Mac OS X Server, this is usually &#039;&#039;&#039;cn=users,dc=my,dc=organization,dc=domain&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Search subcontexts&lt;br /&gt;
| If you have any sub organizational units (subcontexts) hanging from &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; and you want Moodle to search there too, set this to &#039;&#039;&#039;yes&#039;&#039;&#039;. Otherwise, set this to &#039;&#039;&#039;no&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Dereference aliases&lt;br /&gt;
| Sometimes your LDAP server will tell you that the real value you are searching for is in fact in another part of the LDAP tree (this is called an alias). If you want Moodle to &#039;dereference&#039; the alias and fetch the real value from the original location, set this to &#039;&#039;&#039;yes&#039;&#039;&#039;. If you don&#039;t want Moodle to dereference it, set this to &#039;&#039;&#039;no&#039;&#039;&#039;. If you are using MS-AD, set this to &#039;&#039;&#039;no&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| User attribute&lt;br /&gt;
| The attribute used to name/search users in your LDAP tree. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you chose above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in&amp;lt;/u&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
By the way, it&#039;s usually &#039;&#039;&#039;cn&#039;&#039;&#039; (Novell eDirectory and MS-AD) or &#039;&#039;&#039;uid&#039;&#039;&#039; (RFC-2037, RFC-2037bis and SAMBA 3.x LDAP extension), but if you are using MS-AD you could (and have to, if you intend to use NTLM SSO) use &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039; (the pre-Windows 2000 logon account name) if you need too.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Correction&#039;&#039;&#039;: With MS-AD &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039; should be used anyway. With default value (&#039;&#039;&#039;cn&#039;&#039;&#039;) AD users will have to login with full name / password (Username: &#039;&#039;&#039;John Doe&#039;&#039;&#039;, Password: &#039;&#039;&#039;john&#039;s_pass&#039;&#039;&#039;). If you want to enable your users to login with domain username instead (Username: &#039;&#039;&#039;johnd&#039;&#039;&#039; Password: &#039;&#039;&#039;john&#039;s_pass&#039;&#039;&#039;), you should use &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039;. Sadly, but logging in with DOMAIN\user or user@domain.com will not work anyway.&lt;br /&gt;
&lt;br /&gt;
Note: You may wish to consider allowing extended characters in usernames in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Security &amp;gt; [[Site policies]]&#039;&#039;. &lt;br /&gt;
|-&lt;br /&gt;
| Member attribute&lt;br /&gt;
| The attribute used to list the members of a given group. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By the way, the usual values are &#039;&#039;&#039;member&#039;&#039;&#039; and &#039;&#039;&#039;memberUid&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Member attribute uses dn&lt;br /&gt;
| Whether the member attribute contains distinguished names (1) or not (0).This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Object class&lt;br /&gt;
| The type of LDAP object used to search for users. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you chose above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
* If you leave it blank, the default value based on the &#039;&#039;User type&#039;&#039; selected above will be used (see below)&lt;br /&gt;
* If you provide &amp;quot;objectClass=some-string&amp;quot;, then it will provide &amp;quot;(objectClass=some-string)&amp;quot; as the filter.&lt;br /&gt;
* If you provide a value that does not start with &amp;quot;(&amp;quot;, it is assumed to be a value that should be set to &amp;quot;objectClass&amp;quot;. So if you provide &amp;quot;some-string&amp;quot;, then it will provide &amp;quot;(objectClass=some-string)&amp;quot; as the filter.&lt;br /&gt;
* If you provide a string that starts with a &amp;quot;(&amp;quot;, then it will pass that as is. So if you provide &amp;quot;(&amp;amp;(objectClass=user)(enabledMoodleUser=1))&amp;quot;, then it will pass that as the filter.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: In the last case, that feature can be used on interactive logins,&lt;br /&gt;
&lt;br /&gt;
Here are the default values for each of the &#039;&#039;ldap_user_type&#039;&#039; values:&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=user)&#039;&#039;&#039; for Novel eDirectory&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=posixAccount)&#039;&#039;&#039; for RFC-2037 and RFC-2037bis&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=sambaSamAccount)&#039;&#039;&#039; for SAMBA 3.0.x LDAP extension&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=user)&#039;&#039;&#039; for MS-AD&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=*)&#039;&#039;&#039; for Default&lt;br /&gt;
If you get an error about a problem with updating the ldap server (even if you have specified not to write changes back to the ldap server) try setting the ldap object class to * - see http://moodle.org/mod/forum/discuss.php?d=70566 for a discussion on this problem&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Force change password====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Force change password&lt;br /&gt;
| &#039;&#039;&#039;NOTE: This setting is only used when creating your users with the LDAP sync users task. It&#039;s not used if your users are created as part of their first login to moodle&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Set this to &#039;&#039;Yes&#039;&#039; if you want to force your users to change their password on the first login into Moodle. Otherwise, set this to &#039;&#039;no&#039;&#039;. Bear in mind the password they are forced to change is the one stored in your LDAP server.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;As you don&#039;t want your users to change their passwords in their first login, leave this set to &#039;&#039;No&#039;&#039;&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Use standard Change Password Page&lt;br /&gt;
|&lt;br /&gt;
* Setting this to &#039;&#039;Yes&#039;&#039; makes Moodle use its own standard password change page, everytime users want to change their passwords.&lt;br /&gt;
* Setting this to &#039;&#039;No&#039;&#039; makes Moodle use the the page specified in the field called &amp;quot;Password change URL&amp;quot; (see below).&lt;br /&gt;
&lt;br /&gt;
Bear in mind that changing your LDAP passwords from Moodle might require a LDAPS connection (this is actually a requirement for MS-AD). In addition to that, the bind user specified above must have the rights needed to change other users&#039; passwords.&lt;br /&gt;
&lt;br /&gt;
Also, code for changing passwords from Moodle for anything but Novell eDirectory and Active Directory is almost not tested, so this may or may not work for other LDAP servers.&lt;br /&gt;
|-&lt;br /&gt;
| Password Format&lt;br /&gt;
| Specify how the new password is encrypted before sending it to the LDAP server: Plain text, MD5 hash or SHA-1 hash. MS-AD uses plain text, for example.&lt;br /&gt;
|-&lt;br /&gt;
| Password change URL&lt;br /&gt;
| Here you can specify a location at which your users can recover or change their username/password if they&#039;ve forgotten it. This will be provided to users as a button on the login page and their user page. if you leave this blank the button will not be printed.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====LDAP password expiration settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Expiration&lt;br /&gt;
| &lt;br /&gt;
* Setting this to &#039;&#039;No&#039;&#039; will make Moodle not to check if the password of the user has expired or not.&lt;br /&gt;
* Setting this to &#039;&#039;LDAP&#039;&#039; will make Moodle check if the LDAP password of the user has expired or not, and warn them a number of days before the password expires. When the password has expired, a &amp;quot;Your password has expired&amp;quot; message is displayed, and if the user is able to change their password from Moodle, they are offered the option to do so.&lt;br /&gt;
&lt;br /&gt;
Current code only deals with Novell eDirectory LDAP server and MS-AD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So unless you have Novell eDirectory server or MS-AD, choose &#039;&#039;No&#039;&#039; here.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Expiration warning&lt;br /&gt;
| This value sets how many days in advance of password expiration the user is warned that her password is about to expire.&lt;br /&gt;
|-&lt;br /&gt;
| Expiration attribute.&lt;br /&gt;
| The LDAP user attribute used to check password expiration. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Grace logins&lt;br /&gt;
| This setting is specific to Novell eDirectory. If set to &#039;&#039;Yes&#039;&#039;, enable LDAP gracelogin support. After password has expired the user can login until gracelogin count is 0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So unless you have Novell eDirectory server and want to allow gracelogin support, choose &#039;&#039;No&#039;&#039; here.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Grace login attribute&lt;br /&gt;
| This setting is currently not used in the code (and is specific to Novell eDirectory). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Enable user creation====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Create users externally&lt;br /&gt;
| New (anonymous) users can self-create user accounts on the external LDAP server and confirm them via email. If you enable this, remember to also configure module-specific options for user creation and to fill in some instructions in &#039;&#039;auth_instructions&#039;&#039; field in Administration &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication &amp;gt;&amp;gt; Manage authentication. Otherwise the new users won&#039;t be able to self-create new accounts.&lt;br /&gt;
&lt;br /&gt;
Only Novell eDirectory and MS-AD can create users externally (prior to Moodle 2.x). From Moodle 2.0 on, you can also create users in RFC-2307 compliant servers. &lt;br /&gt;
|-&lt;br /&gt;
| Context for new users&lt;br /&gt;
| Specify the context where users are created. This context should be different from other users&#039; contexts to prevent security issues. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Course creation====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Creators&lt;br /&gt;
| The DN of the group that contains all of your Moodle creators. This is typically a posixGroup with a &amp;quot;memberUid&amp;quot; attribute for each user you want to be a creator.  If your group is called &#039;&#039;creators&#039;&#039;, type &#039;&#039;&#039;cn=creators,ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; here.  Each memberUid attribute contains the CN of a user who is authorized to be a creator.  Do not use the user&#039;s full DN (e.g.,  not &#039;&#039;&#039;memberUid: cn=JoeTeacher,ou=moodleusers,dc-my,dc=organizations,dc=domain&#039;&#039;&#039;, but rather &#039;&#039;&#039;memberUid: JoeTeacher&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
In eDirectory, the objectClass for a group is (by default) not &#039;&#039;&#039;posixGroup&#039;&#039;&#039; but &#039;&#039;&#039;groupOfNames,&#039;&#039;&#039; whose member attribute is &#039;&#039;&#039;member,&#039;&#039;&#039; not &#039;&#039;&#039;memberUid,&#039;&#039;&#039; and whose value is the full DN of the user in question.  Although you can probably modify Moodle&#039;s code to use this field, a better solution is just to add a new &#039;&#039;&#039;objectClass&#039;&#039;&#039; attribute of &#039;&#039;&#039;posixGroup&#039;&#039;&#039; to your creators group and put the CNs for each creator in a &#039;&#039;&#039;memberUid&#039;&#039;&#039; attribute.&lt;br /&gt;
&lt;br /&gt;
In MS Active Directory, you will need to create a security group for your creators to be part of and then add them all. If your ldap context above is &#039;ou=staff,dc=my,dc=org&#039; then your group should then be &#039;cn=creators,ou=staff,dc=my,dc=org&#039;. If some of the users are from other contexts and have been added to the same security group, you&#039;ll have to add these as separate contexts after the first one using the same format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Cron synchronization script====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Removed ext user&lt;br /&gt;
| Specify what to do with internal user account during mass synchronization when user was removed from external source. Only suspended users are automatically revived if they reappear in ext source.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====NTLM SSO====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Enable&lt;br /&gt;
| If you want to use NTLM SSO (see details at [[NTLM_authentication]]), choose &#039;&#039;Yes&#039;&#039; here. Otherwise, choose &#039;&#039;No&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Subnet&lt;br /&gt;
| Specify the subnets of the clients that will use NTLM SSO (see details at [[NTLM_authentication]]).&lt;br /&gt;
|-&lt;br /&gt;
| MS IE Fast Path?&lt;br /&gt;
| If all of you clients (or most of them) are using MS Internet Explorer, you can set this option to bypasses certain steps of the SSO login and speed up login times. This only works with MS Internet Explorer, but deals with other browsers in a sensible way (they are automatically sent to the plain login page).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Data Mapping====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| First name&lt;br /&gt;
| The name of the attribute that holds the first name of your users in your LDAP server. This is usually &#039;&#039;&#039;givenName&#039;&#039;&#039; or &#039;&#039;&#039;displayName&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Surname&lt;br /&gt;
| The name of the attribute that holds the surname of your users in your LDAP server. This is usually &#039;&#039;&#039;sn&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Email address&lt;br /&gt;
| The name of the attribute that holds the email address of your users in your LDAP server. This is usually &#039;&#039;&#039;mail&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| City/town&lt;br /&gt;
| The name of the attribute that holds the city/town of your users in your LDAP server. This is usully &#039;&#039;&#039;l&#039;&#039;&#039; (lowercase L) or &#039;&#039;&#039;localityName&#039;&#039;&#039; (not valid in MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| Country&lt;br /&gt;
| The name of the attribute that holds the country of your users in your LDAP server. This is usully &#039;&#039;&#039;c&#039;&#039;&#039; or &#039;&#039;&#039;countryName&#039;&#039;&#039; (not valid in MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Language&lt;br /&gt;
| &#039;&#039;&#039;preferredLanguage&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Description&lt;br /&gt;
| &#039;&#039;&#039;description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Webpage&lt;br /&gt;
| &amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ID Number&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Institution&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Department&lt;br /&gt;
| The name of the attribute that holds the department name of your users in your LDAP server. This is usully &#039;&#039;&#039;departmentNumber&#039;&#039;&#039; (for posixAccount and maybe eDirectory) or &#039;&#039;&#039;department&#039;&#039;&#039; (for MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Phone 1&lt;br /&gt;
| The name of the attribute that holds the telephone number of your users in your LDAP server. This is usually &#039;&#039;&#039;telephoneNumber&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Phone 2&lt;br /&gt;
|  The name of the attribute that holds an additional telephone number of your users in your LDAP server. This can be &#039;&#039;&#039;homePhone&#039;&#039;&#039;, &#039;&#039;&#039;mobile&#039;&#039;&#039;, &#039;&#039;&#039;pager&#039;&#039;&#039;, &#039;&#039;&#039;facsimileTelephoneNumber&#039;&#039;&#039; or even others.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Address&lt;br /&gt;
| The name of the attribute that holds the street address of your users in your LDAP server. This is usully &#039;&#039;&#039;streetAddress&#039;&#039;&#039; or &#039;&#039;&#039;street&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=====Custom User profile fields=====&lt;br /&gt;
Custom Profile Fields are now supported. &lt;br /&gt;
&lt;br /&gt;
Any user profile fields created in &#039;&#039;Site administration &amp;gt; Users &amp;gt; Accounts &amp;gt; User profile fields&#039;&#039; should now automatically show up at the end of the Data mapping field list after the &#039;&#039;&#039;Address&#039;&#039;&#039; field. See example: [[File:ldapcustomuserprofilefields.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
===Setting up regular automatic synchronisation using schedule task===&lt;br /&gt;
There is a default scheduled task to synchronize your moodle with a LDAP server. The task &#039;&#039;&#039;LDAP users sync job (\auth_ldap\task\sync_task)&#039;&#039;&#039;  is responsible for create, update user information, suspend and delete all LDAP accounts automatically. &lt;br /&gt;
The scheduled task can be enabled and configured on Site Administration &amp;gt; Server &amp;gt; Scheduled tasks by clicking on the gear icon. Select the desired frequency of running and enable the task, un-checking the Disabled checkbox.&lt;br /&gt;
It is important, however, to make sure that all of the above LDAP settings are working properly before you try this, as well as backing up your database and moodledata folders. Poor LDAP configuration could lead to users being wrongly deleted.&lt;br /&gt;
&lt;br /&gt;
If you find that the script is not running through all of your users properly and you have over 1000 users in each LDAP container, this is because by default some LDAP stores such as MS AD only send back 1000 users at a time and PHP versions prior to 5.4 did not implement paged support for LDAP results. If you upgrade to PHP 5.4 or higher then Moodle will obtain all your users correctly. If you can&#039;t upgrade to PHP 5.4 you may be able to follow the instructions [http://support.microsoft.com/kb/315071 here] to set the Active Directory MaxPageSize setting to a number higher than your total number of users (both now and in future) to fix it. This is a forest-wide setting.&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
==Active Directory help==&lt;br /&gt;
[[Active Directory]] is Microsoft&#039;s directory service. It is included in Windows 2000 Server and later versions of their operating system. For more information about subjects below, &#039;&#039;&#039;[[Active Directory|please go here]]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
*Warning: The PHP LDAP module does not seem to be present&lt;br /&gt;
*LDAP-module cannot connect any LDAP servers &lt;br /&gt;
*Getting correct CNs for Contexts and Creators&lt;br /&gt;
*Getting the right user_attribute&lt;br /&gt;
*Installing ldp.exe Server Tool&lt;br /&gt;
*Example Active Directory Configuration&lt;br /&gt;
*Child Domains and the Global Catalog in MS Active Directory&lt;br /&gt;
*Enabling the Global Catalog&lt;br /&gt;
*Active Directory with Moodle 1.8&lt;br /&gt;
*MS Active Directory + SSL&lt;br /&gt;
&lt;br /&gt;
==Advanced Scenarios - Multiple servers or locations==&lt;br /&gt;
For larger installations with  multiple LDAP servers, or multiple locations (contexts) in a LDAP tree.&lt;br /&gt;
&lt;br /&gt;
===Making your LDAP directory connection resilient===&lt;br /&gt;
* Entering more than one name in the ldap_host_url field can provide some sort of resilience to your system. Simply use the syntax:&lt;br /&gt;
&lt;br /&gt;
 ldap://my.first.server; ldap://my.second.server; ...&lt;br /&gt;
&lt;br /&gt;
Of course, this will only work if all the servers share the same directory information, if using eDirectory you would need to ensure your servers have viability of all relevant tree partitions, or if using Active Directory the servers are holding the same information you need though replication - see notes on a multi-domain environment if this applies.&lt;br /&gt;
&lt;br /&gt;
There is one drawback in Moodle 1.5 - 1.6 implementation of LDAP authentication : the auth_ldap_connect() function processes the servers sequentially, not in a round robin mode. Thus, if the primary server fails, you will have to wait for the connection to time out before switching to the following one.&lt;br /&gt;
&lt;br /&gt;
See also: [http://moodle.org/mod/forum/discuss.php?d=17198 Using multiple LDAP servers - Our students are on separate domain discussion on the Using Moodle forum.&lt;br /&gt;
&lt;br /&gt;
===Using a multi-domain AD environment===&lt;br /&gt;
* If you&#039;re running Active Directory with multiple domains and you have users in more then one domain you will want to configure Moodle to look at your Global Catalog server. Specifically your top level domain Global Catalog server. Here is a simple example of this kind of Active Directory layout:&lt;br /&gt;
&lt;br /&gt;
 my.domain.ca (Root AD Domain)&lt;br /&gt;
 | - dc1.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - dc2.my.domain.ca (Domain Controller)&lt;br /&gt;
 |&lt;br /&gt;
 | - - students.my.domain.ca (Sub AD Domain)&lt;br /&gt;
 | - - - dc1.students.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - - - dc2.students.my.domain.ca (Domain Controller)&lt;br /&gt;
 |&lt;br /&gt;
 | - - faculty.my.domain.ca (Sub AD Domain)&lt;br /&gt;
 | - - - dc1.faculty.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - - - dc2.faculty.my.domain.ca (Domain Controller)&lt;br /&gt;
 &lt;br /&gt;
In this example we have our top level domain (my.domain.ca) and two sub-domains. One sub-domain is for faculty accounts (faculty.my.domain.ca) and the other is for student accounts (students.my.domain.ca). Listed under each of those are two domain controllers.&lt;br /&gt;
&lt;br /&gt;
Using the above example you&#039;ll want to use the following for accessing the Global Catalog over SSL:&lt;br /&gt;
&lt;br /&gt;
 ldaps://my.domain.ca:3269/&lt;br /&gt;
&lt;br /&gt;
If you prefer to access your global catalog over a non-SSL connection you&#039;ll want to use:&lt;br /&gt;
&lt;br /&gt;
 ldap://my.domain.ca:3268/&lt;br /&gt;
 &lt;br /&gt;
We found if you didn&#039;t configure things this way you&#039;d get errors like:&lt;br /&gt;
&lt;br /&gt;
  [Thu May 26 15:23:53 2011] [error] [client 192.168.xxx.xxx] PHP Warning:  ldap_search() [&amp;lt;a href=&#039;function.ldap-search&#039;&amp;gt;function.ldap-search&amp;lt;/a&amp;gt;]: Search: Partial results and referral received in /xxx/xxx/moodle20/lib/ldaplib.php on line 241, referer: http://moodle.my.domain.ca/moodle20/login/index.php&lt;br /&gt;
  [Thu May 26 15:23:53 2011] [error] [client 192.168.xxx.xxx] PHP Warning:  ldap_first_entry(): supplied argument is not a valid ldap result resource in /xxx/xxx/moodle20/lib/ldaplib.php on line 248, referer: http://moodle.my.domain.ca/moodle20/login/index.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Using multiple user locations (contexts) in your LDAP tree===&lt;br /&gt;
There is no need to use multiple user locations if your directory tree is flat, i.e. if all user accounts reside in a &#039;&#039;&#039;ou=people,dc=my,dc=organization,dc=domain&#039;&#039;&#039; or &#039;&#039;&#039;ou=people,o=myorg&#039;&#039;&#039; container. &lt;br /&gt;
&lt;br /&gt;
At the opposite, if you use the ACL mecanism to delegate user management, there are chances that your users will be stored in containers like &#039;&#039;&#039;ou=students,ou=dept1,o=myorg&#039;&#039;&#039; and &#039;&#039;&#039;ou=students,ou=dept2,o=myorg&#039;&#039;&#039; ...&lt;br /&gt;
&lt;br /&gt;
Then there is an alternative :&lt;br /&gt;
* Look at the &#039;&#039;&#039;o=myorg&#039;&#039;&#039; level with the ldap_search_sub attribute set to &#039;&#039;&#039;yes&#039;&#039;&#039;.&lt;br /&gt;
* Set the ldap_context to &#039;&#039;&#039;ou=students,ou=dept1,o=myorg ; ou=students,ou=dept2,o=myorg&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Choosing between these two solutions supposes some sort of benchmarking, as the result depends heavily on the structure of your directory tree &#039;&#039;&#039;and&#039;&#039;&#039; on your LDAP software indexing capabilities. Simply note that there is a probability in such deep trees that two users share the same &#039;&#039;common name&#039;&#039; (cn), while having different &#039;&#039;distinguished names&#039;&#039;. Then only the second solution will have a deterministic result (returning allways the same user).&lt;br /&gt;
&lt;br /&gt;
===Using LDAPS (LDAP over SSL)===&lt;br /&gt;
====Enabling LDAPS on your directory server====&lt;br /&gt;
&lt;br /&gt;
* [[Active_Directory#MS_Active_Directory_.2B_SSL|Enabling LDAPS on MS Active Directory ]]&lt;br /&gt;
&lt;br /&gt;
====Enabling LDAPS on your Moodle server====&lt;br /&gt;
Enabling LDAPS on your server can be tricky and often it is hard to pinpoint where things are going wrong. There are also differences between Windows and Linux and even different versions and distributions of Linux. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;If you have not done so already you will need to decide upon your approach to establishing an SSL connection to your directory server:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* SSL connection with unverified self-signed certificate.&lt;br /&gt;
&lt;br /&gt;
You can generate your own SSL certificate, and then instruct your Moodle server to ignore the fact that it is not valid. This setup is not as secure as others since you cannot be sure the server you are connecting to is not fake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* SSL connection with trusted self-signed certificate.&lt;br /&gt;
&lt;br /&gt;
You can generate your own SSL certificate on your directory server, and then specifically trust this certificate by installing it on your Moodle server. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* SSL connection with verified certificate from Internet-trusted certificate authority (CA)&lt;br /&gt;
&lt;br /&gt;
In this approach the LDAP server has an installed certificate from an Internet-based CA, this means that your directory server would have an Internet address &amp;amp; host name. Your Moodle server must be trusting the certificate authority and have Internet access. This approach is not often used as it usually incurs a cost for the certificate, and it requires your directory server and Moodle server to be exposed to the Internet.&lt;br /&gt;
&lt;br /&gt;
==Linux servers==&lt;br /&gt;
&#039;&#039;&#039;These instructions are for establishing a link using a trusted self-signed certificate.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: written for a Red Hat Enterprise Linux 6 server, other Linux distributions may differ, especially in the location of the SSL certificates and OpenLdap config files, but the core principals are the same.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check that your directory server is online and accepting SSL connections on your LDAPS port (636), you can use try:&lt;br /&gt;
 openssl s_client –connect &amp;lt;ldap server ip address&amp;gt;:636&lt;br /&gt;
&lt;br /&gt;
Get your directory server’s certificate (.crt) and upload to Moodle server&#039;s ssl certificate directory, on RHEL6 this is at &#039;&#039;&#039;/etc/ssl/certs&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Convert your ‘DER’ X509 certificate into a ‘PEM’ public key certificate.&lt;br /&gt;
 openssl x509 -in my_server_certificate.cer -inform DER -out my_server_certificate.pem -outform PEM&lt;br /&gt;
&lt;br /&gt;
Create certificate hashes using c_rehash&lt;br /&gt;
 c_rehash&lt;br /&gt;
&#039;&#039;If c_rehash is not installed install with: yum install /usr/bin/c_rehash&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ensure you are able to access your LDAPS server by a DNS name, this may mean adding an entry to your host file (/etc/hosts)&lt;br /&gt;
 &amp;lt;ldap server ip address&amp;gt;    my_server.mydomain.school&lt;br /&gt;
&lt;br /&gt;
Verify your certificate to check that it is installed correctly&lt;br /&gt;
 openssl verify -verbose -CApath /etc/ssl/certs /etc/ssl/certs/my_server_certificate.pem&lt;br /&gt;
 /etc/ssl/certs/my_server_certificate.pem: OK&lt;br /&gt;
&lt;br /&gt;
You should now be able to connect to your LDAPS server over SSL without any errors&lt;br /&gt;
 openssl s_client –connect &amp;lt;ldap server DNS name&amp;gt;:636&lt;br /&gt;
&lt;br /&gt;
Edit your OpenLDAP config, on RHEL6 this is located at &#039;&#039;&#039;/etc/openldap/ldap.conf&#039;&#039;&#039;&lt;br /&gt;
 # Define location of a CA Cert&lt;br /&gt;
 TLS_CACERT /etc/ssl/certs/my_server_certificate.pem&lt;br /&gt;
 TLS_CACERTDIR /etc/ssl/certs&lt;br /&gt;
&lt;br /&gt;
Finally, you may or may not need to restart Apache, before configuring Moodle to use ldaps://&amp;lt;server DNS name&amp;gt;&lt;br /&gt;
 httpd -k restart&lt;br /&gt;
&lt;br /&gt;
==Windows servers==&lt;br /&gt;
&#039;&#039;&#039;These instructions are for establishing a link using an unverified self-signed certificate&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can tell PHP&#039;s OpenLDAP extension to disable SSL server certificate checking to do this you must create a directory called &#039;&#039;&#039;&#039;C:\OpenLDAP\sysconf\&#039;&#039;&#039;&#039; In this directory, create a file called &#039;&#039;ldap.conf&#039;&#039; with the following content:&lt;br /&gt;
&lt;br /&gt;
 TLS_REQCERT never&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;(If you are using certain versions of PHP 5.3.x you &#039;&#039;&#039;may need to place the file at other locations&#039;&#039;&#039;, [http://bugs.php.net/bug.php?id=48866 see PHP bug #48866])&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now you should be able to use &#039;&#039;&#039;ldaps://&#039;&#039;&#039; when connecting to your LDAP server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
==Appendices==&lt;br /&gt;
&lt;br /&gt;
=== Setting Resource Limits RedHat Directory Server ===&lt;br /&gt;
&lt;br /&gt;
Operational attributes can be set for the bind user DN using the command-line. &lt;br /&gt;
One can simply use ldapmodify to add the following attributes:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Attribute Name &lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| nsLookThroughLimit&lt;br /&gt;
| Specifies how many entries are examined for a search operation. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsSizeLimit &lt;br /&gt;
| Specifies the maximum number of entries the server returns to a client application in response to a search operation. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsTimeLimit &lt;br /&gt;
| Specifies the maximum time the server spends processing a search operation. Giving this attribute a value of -1 indicates that there is no time limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsIdleTimeout 	        &lt;br /&gt;
| Specifies the time a connection to the server can be idle before the connection is dropped. The value is given in seconds. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; LDAP Console Command-Line&lt;br /&gt;
&lt;br /&gt;
 ldapmodify -h redhat_dir_server -p 389 -D &amp;quot;cn=directory manager&amp;quot; -w secretpwd&lt;br /&gt;
&lt;br /&gt;
 dn: uid=MoodleAdmin,ou=system,dc=myschool,dc=edu&lt;br /&gt;
 changetype: modify&lt;br /&gt;
 add:nsSizeLimit&lt;br /&gt;
 nsSizeLimit: 1000&lt;br /&gt;
 &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[NTLM_authentication]]&lt;br /&gt;
* [[Active_Directory]]&lt;br /&gt;
* [[LDAP enrolment]]&lt;br /&gt;
* [http://download.moodle.org/download.php/docs/en/how-to_guides/ldap_auth_and_enrolment_set-up.pdf LDAP auth and enrolment set-up guide] (PDF 227KB)&lt;br /&gt;
&lt;br /&gt;
Using Moodle:&lt;br /&gt;
* [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=32168 PHP LDAP module does not seem to be present] forum discussion&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=140901 Syncronisation with AUTH_LDAP_SYNC_USERS.PHP produces fewer accounts than it should] forum discussion&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=17198 Using multiple LDAP servers] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[es:LDAP_authentication]]&lt;br /&gt;
[[fr:Utiliser un serveur LDAP]]&lt;br /&gt;
[[ja:LDAP認証]]&lt;br /&gt;
[[de:LDAP-Server]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=LDAP_authentication&amp;diff=120979</id>
		<title>LDAP authentication</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=LDAP_authentication&amp;diff=120979"/>
		<updated>2015-11-03T06:18:40Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* Force change password */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
Location: Settings link in &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage authentication&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This document describes how to set up Lightweight Directory Access Protocol (LDAP) authentication in Moodle.  We cover the basic, advanced and some trouble shooting sections to assist the user in the installation and administrating LDAP in Moodle.  &lt;br /&gt;
==Table of Contents==&lt;br /&gt;
__TOC__&lt;br /&gt;
==Basic Scenario==&lt;br /&gt;
The simple and straightforward approach  for most installations.&lt;br /&gt;
&lt;br /&gt;
===Assumptions===&lt;br /&gt;
&lt;br /&gt;
# Your Moodle site is located at &#039;&#039;&#039;http://your.moodle.site/&#039;&#039;&#039;&lt;br /&gt;
# You have configured your PHP installation with the LDAP extension. It is loaded and activated, and it shows when you go to &#039;&#039;&#039;http://your.moodle.site/admin/phpinfo.php&#039;&#039;&#039; (logged in as user &#039;admin&#039;).&lt;br /&gt;
# Your LDAP server has &#039;&#039;&#039;192.168.1.100&#039;&#039;&#039; as its IP address.&lt;br /&gt;
# You are not using LDAP with SSL (also known as LDAPS) in your settings. This might prevent certain operations from working (e.g., you cannot update data if you are using MS Active Directory -- MS-AD from here on --), but should be OK if you just want to authenticate your users.&lt;br /&gt;
# You don&#039;t want your users to change their passwords the first time they log in into Moodle.&lt;br /&gt;
# You are using a single domain as the source of your authentication data in case you are using MS-AD (more on this in the Appendices).&lt;br /&gt;
# You are using a top level distinguished name (DN) of &#039;&#039;&#039;dc=my,dc=organization,dc=domain&#039;&#039;&#039; as the root of your LDAP tree. &lt;br /&gt;
# You have a non-privileged LDAP user account you will use to bind to the LDAP server. This is not necessary with certain LDAP servers, but MS-AD requires this and it won&#039;t hurt if you use it even if your LDAP server doesn&#039;t need it. Make sure &#039;&#039;&#039;this account and its password don&#039;t expire&#039;&#039;&#039;, and make this password as strong as possible. Remember you only need to type this password once, when configuring Moodle, so don&#039;t be afraid of making it as hard to guess as possible. Let&#039;s say this user account has a DN of &#039;&#039;&#039;cn=ldap-user,dc=my,dc=organization,dc=domain&#039;&#039;&#039;, and password &#039;&#039;&#039;hardtoguesspassword&#039;&#039;&#039;.&lt;br /&gt;
# All of your Moodle users are in an organizational unit (OU) called &#039;&#039;&#039;moodleusers&#039;&#039;&#039;, which is right under your LDAP root. That OU has a DN of &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039;.&lt;br /&gt;
# You &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; want your LDAP users&#039; passwords to be stored in Moodle at all.&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
===Configuring Moodle authentication===&lt;br /&gt;
&lt;br /&gt;
Log in as an admin user and go to &#039;&#039;Administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage authentication&#039;&#039;. In the table that appears, enable the &amp;quot;LDAP Server&amp;quot; authentication option (click on the closed eye to make it open) and then click on the associated &#039;Settings&#039; link. You will get a page similar to this one:&lt;br /&gt;
&lt;br /&gt;
[[Image:LDAPserversettings.png|center]]&lt;br /&gt;
&lt;br /&gt;
Now, you just have to fill in the values. Let&#039;s go step by step.&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====LDAP Server Settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Host URL&lt;br /&gt;
| As the IP of your LDAP server is 192.168.1.100, type &amp;quot;&#039;&#039;&#039;ldap://192.168.1.100&#039;&#039;&#039;&amp;quot; (without the quotes), or just &amp;quot;&#039;&#039;&#039;192.168.1.100&#039;&#039;&#039;&amp;quot; (some people have trouble connecting with the first syntax, specially on MS Windows servers).&lt;br /&gt;
|-&lt;br /&gt;
| Version&lt;br /&gt;
| Unless you are using a really old LDAP server, &#039;&#039;&#039;version 3&#039;&#039;&#039; is the one you should choose.&lt;br /&gt;
|-&lt;br /&gt;
| LDAP Encoding&lt;br /&gt;
| Specify encoding used by LDAP server. Most probably utf-8.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Bind settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Don&#039;t cache passwords&lt;br /&gt;
| As you &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; want to store the users&#039;s password in Moodle&#039;s database, choose &#039;&#039;&#039;Yes&#039;&#039;&#039; here.&lt;br /&gt;
|-&lt;br /&gt;
| Distinguished Name&lt;br /&gt;
| This is the distinguished name of the bind user defined above. Just type &amp;quot;&#039;&#039;&#039;cn=ldap-user,dc=my,dc=organization,dc=domain&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|-&lt;br /&gt;
| Password&lt;br /&gt;
| This is the bind user password defined above. Type &amp;quot;&#039;&#039;&#039;hardtoguesspassword&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====User lookup settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| User type&lt;br /&gt;
| Choose: &lt;br /&gt;
* &#039;&#039;&#039;Novel Edirectory&#039;&#039;&#039; if your LDAP server is running Novell&#039;s eDdirectory.&lt;br /&gt;
* &#039;&#039;&#039;posixAccount (rfc2307)&#039;&#039;&#039; if your LDAP server is running a RFC-2307 compatible LDAP server (choose this is your server is running OpenLDAP, including Mac OS X server).&lt;br /&gt;
* &#039;&#039;&#039;posixAccount (rfc2307bis)&#039;&#039;&#039; if your LDAP server is running a RFC-2307bis compatible LDAP server.&lt;br /&gt;
* &#039;&#039;&#039;sambaSamAccount (v.3.0.7)&#039;&#039;&#039; if your LDAP server is running with SAMBA&#039;s 3.x LDAP schema extension and you want to use it.&lt;br /&gt;
* &#039;&#039;&#039;MS ActiveDirectory&#039;&#039;&#039; if your LDAP server is running Microsoft&#039;s Active Directory (MS-AD)&lt;br /&gt;
|-&lt;br /&gt;
| Contexts&lt;br /&gt;
| The DN of the context (container) where all of your Moodle users are found. Type &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; here.  &lt;br /&gt;
&lt;br /&gt;
On a Mac OS X Server, this is usually &#039;&#039;&#039;cn=users,dc=my,dc=organization,dc=domain&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Search subcontexts&lt;br /&gt;
| If you have any sub organizational units (subcontexts) hanging from &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; and you want Moodle to search there too, set this to &#039;&#039;&#039;yes&#039;&#039;&#039;. Otherwise, set this to &#039;&#039;&#039;no&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Dereference aliases&lt;br /&gt;
| Sometimes your LDAP server will tell you that the real value you are searching for is in fact in another part of the LDAP tree (this is called an alias). If you want Moodle to &#039;dereference&#039; the alias and fetch the real value from the original location, set this to &#039;&#039;&#039;yes&#039;&#039;&#039;. If you don&#039;t want Moodle to dereference it, set this to &#039;&#039;&#039;no&#039;&#039;&#039;. If you are using MS-AD, set this to &#039;&#039;&#039;no&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| User attribute&lt;br /&gt;
| The attribute used to name/search users in your LDAP tree. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you chose above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in&amp;lt;/u&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
By the way, it&#039;s usually &#039;&#039;&#039;cn&#039;&#039;&#039; (Novell eDirectory and MS-AD) or &#039;&#039;&#039;uid&#039;&#039;&#039; (RFC-2037, RFC-2037bis and SAMBA 3.x LDAP extension), but if you are using MS-AD you could (and have to, if you intend to use NTLM SSO) use &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039; (the pre-Windows 2000 logon account name) if you need too.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Correction&#039;&#039;&#039;: With MS-AD &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039; should be used anyway. With default value (&#039;&#039;&#039;cn&#039;&#039;&#039;) AD users will have to login with full name / password (Username: &#039;&#039;&#039;John Doe&#039;&#039;&#039;, Password: &#039;&#039;&#039;john&#039;s_pass&#039;&#039;&#039;). If you want to enable your users to login with domain username instead (Username: &#039;&#039;&#039;johnd&#039;&#039;&#039; Password: &#039;&#039;&#039;john&#039;s_pass&#039;&#039;&#039;), you should use &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039;. Sadly, but logging in with DOMAIN\user or user@domain.com will not work anyway.&lt;br /&gt;
&lt;br /&gt;
Note: You may wish to consider allowing extended characters in usernames in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Security &amp;gt; [[Site policies]]&#039;&#039;. &lt;br /&gt;
|-&lt;br /&gt;
| Member attribute&lt;br /&gt;
| The attribute used to list the members of a given group. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By the way, the usual values are &#039;&#039;&#039;member&#039;&#039;&#039; and &#039;&#039;&#039;memberUid&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Member attribute uses dn&lt;br /&gt;
| Whether the member attribute contains distinguished names (1) or not (0).This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Object class&lt;br /&gt;
| The type of LDAP object used to search for users. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you chose above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
* If you leave it blank, the default value based on the &#039;&#039;User type&#039;&#039; selected above will be used (see below)&lt;br /&gt;
* If you provide &amp;quot;objectClass=some-string&amp;quot;, then it will provide &amp;quot;(objectClass=some-string)&amp;quot; as the filter.&lt;br /&gt;
* If you provide a value that does not start with &amp;quot;(&amp;quot;, it is assumed to be a value that should be set to &amp;quot;objectClass&amp;quot;. So if you provide &amp;quot;some-string&amp;quot;, then it will provide &amp;quot;(objectClass=some-string)&amp;quot; as the filter.&lt;br /&gt;
* If you provide a string that starts with a &amp;quot;(&amp;quot;, then it will pass that as is. So if you provide &amp;quot;(&amp;amp;(objectClass=user)(enabledMoodleUser=1))&amp;quot;, then it will pass that as the filter.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: In the last case, that feature can be used on interactive logins,&lt;br /&gt;
&lt;br /&gt;
Here are the default values for each of the &#039;&#039;ldap_user_type&#039;&#039; values:&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=user)&#039;&#039;&#039; for Novel eDirectory&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=posixAccount)&#039;&#039;&#039; for RFC-2037 and RFC-2037bis&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=sambaSamAccount)&#039;&#039;&#039; for SAMBA 3.0.x LDAP extension&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=user)&#039;&#039;&#039; for MS-AD&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=*)&#039;&#039;&#039; for Default&lt;br /&gt;
If you get an error about a problem with updating the ldap server (even if you have specified not to write changes back to the ldap server) try setting the ldap object class to * - see http://moodle.org/mod/forum/discuss.php?d=70566 for a discussion on this problem&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Force change password====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Force change password&lt;br /&gt;
| &#039;&#039;&#039;NOTE: This setting is only used when creating your users with the LDAP sync users task. It&#039;s not used if your users are created as part of their first login to moodle&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Set this to &#039;&#039;Yes&#039;&#039; if you want to force your users to change their password on the first login into Moodle. Otherwise, set this to &#039;&#039;no&#039;&#039;. Bear in mind the password they are forced to change is the one stored in your LDAP server.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;As you don&#039;t want your users to change their passwords in their first login, leave this set to &#039;&#039;No&#039;&#039;&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Use standard Change Password Page&lt;br /&gt;
|&lt;br /&gt;
* Setting this to &#039;&#039;Yes&#039;&#039; makes Moodle use its own standard password change page, everytime users want to change their passwords.&lt;br /&gt;
* Setting this to &#039;&#039;No&#039;&#039; makes Moodle use the the page specified in the field called &amp;quot;Password change URL&amp;quot; (see below).&lt;br /&gt;
&lt;br /&gt;
Bear in mind that changing your LDAP passwords from Moodle might require a LDAPS connection (this is actually a requirement for MS-AD). In addition to that, the bind user specified above must have the rights needed to change other users&#039; passwords.&lt;br /&gt;
&lt;br /&gt;
Also, code for changing passwords from Moodle for anything but Novell eDirectory and Active Directory is almost not tested, so this may or may not work for other LDAP servers.&lt;br /&gt;
|-&lt;br /&gt;
| Password Format&lt;br /&gt;
| Specify how the new password is encrypted before sending it to the LDAP server: Plain text, MD5 hash or SHA-1 hash. MS-AD uses plain text, for example.&lt;br /&gt;
|-&lt;br /&gt;
| Password change URL&lt;br /&gt;
| Here you can specify a location at which your users can recover or change their username/password if they&#039;ve forgotten it. This will be provided to users as a button on the login page and their user page. if you leave this blank the button will not be printed.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====LDAP password expiration settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Expiration&lt;br /&gt;
| &lt;br /&gt;
* Setting this to &#039;&#039;No&#039;&#039; will make Moodle not to check if the password of the user has expired or not.&lt;br /&gt;
* Setting this to &#039;&#039;LDAP&#039;&#039; will make Moodle check if the LDAP password of the user has expired or not, and warn them a number of days before the password expires. When the password has expired, a &amp;quot;Your password has expired&amp;quot; message is displayed, and if the user is able to change their password from Moodle, they are offered the option to do so.&lt;br /&gt;
&lt;br /&gt;
Current code only deals with Novell eDirectory LDAP server and MS-AD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So unless you have Novell eDirectory server or MS-AD, choose &#039;&#039;No&#039;&#039; here.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Expiration warning&lt;br /&gt;
| This value sets how many days in advance of password expiration the user is warned that her password is about to expire.&lt;br /&gt;
|-&lt;br /&gt;
| Expiration attribute.&lt;br /&gt;
| The LDAP user attribute used to check password expiration. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Grace logins&lt;br /&gt;
| This setting is specific to Novell eDirectory. If set to &#039;&#039;Yes&#039;&#039;, enable LDAP gracelogin support. After password has expired the user can login until gracelogin count is 0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So unless you have Novell eDirectory server and want to allow gracelogin support, choose &#039;&#039;No&#039;&#039; here.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Grace login attribute&lt;br /&gt;
| This setting is currently not used in the code (and is specific to Novell eDirectory). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Enable user creation====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Create users externally&lt;br /&gt;
| New (anonymous) users can self-create user accounts on the external LDAP server and confirm them via email. If you enable this, remember to also configure module-specific options for user creation and to fill in some instructions in &#039;&#039;auth_instructions&#039;&#039; field in Administration &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication &amp;gt;&amp;gt; Manage authentication. Otherwise the new users won&#039;t be able to self-create new accounts.&lt;br /&gt;
&lt;br /&gt;
Only Novell eDirectory and MS-AD can create users externally (prior to Moodle 2.x). From Moodle 2.0 on, you can also create users in RFC-2307 compliant servers. &lt;br /&gt;
|-&lt;br /&gt;
| Context for new users&lt;br /&gt;
| Specify the context where users are created. This context should be different from other users&#039; contexts to prevent security issues. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Course creation====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Creators&lt;br /&gt;
| The DN of the group that contains all of your Moodle creators. This is typically a posixGroup with a &amp;quot;memberUid&amp;quot; attribute for each user you want to be a creator.  If your group is called &#039;&#039;creators&#039;&#039;, type &#039;&#039;&#039;cn=creators,ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; here.  Each memberUid attribute contains the CN of a user who is authorized to be a creator.  Do not use the user&#039;s full DN (e.g.,  not &#039;&#039;&#039;memberUid: cn=JoeTeacher,ou=moodleusers,dc-my,dc=organizations,dc=domain&#039;&#039;&#039;, but rather &#039;&#039;&#039;memberUid: JoeTeacher&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
In eDirectory, the objectClass for a group is (by default) not &#039;&#039;&#039;posixGroup&#039;&#039;&#039; but &#039;&#039;&#039;groupOfNames,&#039;&#039;&#039; whose member attribute is &#039;&#039;&#039;member,&#039;&#039;&#039; not &#039;&#039;&#039;memberUid,&#039;&#039;&#039; and whose value is the full DN of the user in question.  Although you can probably modify Moodle&#039;s code to use this field, a better solution is just to add a new &#039;&#039;&#039;objectClass&#039;&#039;&#039; attribute of &#039;&#039;&#039;posixGroup&#039;&#039;&#039; to your creators group and put the CNs for each creator in a &#039;&#039;&#039;memberUid&#039;&#039;&#039; attribute.&lt;br /&gt;
&lt;br /&gt;
In MS Active Directory, you will need to create a security group for your creators to be part of and then add them all. If your ldap context above is &#039;ou=staff,dc=my,dc=org&#039; then your group should then be &#039;cn=creators,ou=staff,dc=my,dc=org&#039;. If some of the users are from other contexts and have been added to the same security group, you&#039;ll have to add these as separate contexts after the first one using the same format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Cron synchronization script====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Removed ext user&lt;br /&gt;
| Specify what to do with internal user account during mass synchronization when user was removed from external source. Only suspended users are automatically revived if they reappear in ext source.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====NTLM SSO====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Enable&lt;br /&gt;
| If you want to use NTLM SSO (see details at [[NTLM_authentication]]), choose &#039;&#039;Yes&#039;&#039; here. Otherwise, choose &#039;&#039;No&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Subnet&lt;br /&gt;
| Specify the subnets of the clients that will use NTLM SSO (see details at [[NTLM_authentication]]).&lt;br /&gt;
|-&lt;br /&gt;
| MS IE Fast Path?&lt;br /&gt;
| If all of you clients (or most of them) are using MS Internet Explorer, you can set this option to bypasses certain steps of the SSO login and speed up login times. This only works with MS Internet Explorer, but deals with other browsers in a sensible way (they are automatically sent to the plain login page).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Data Mapping====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| First name&lt;br /&gt;
| The name of the attribute that holds the first name of your users in your LDAP server. This is usually &#039;&#039;&#039;givenName&#039;&#039;&#039; or &#039;&#039;&#039;displayName&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Surname&lt;br /&gt;
| The name of the attribute that holds the surname of your users in your LDAP server. This is usually &#039;&#039;&#039;sn&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Email address&lt;br /&gt;
| The name of the attribute that holds the email address of your users in your LDAP server. This is usually &#039;&#039;&#039;mail&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| City/town&lt;br /&gt;
| The name of the attribute that holds the city/town of your users in your LDAP server. This is usully &#039;&#039;&#039;l&#039;&#039;&#039; (lowercase L) or &#039;&#039;&#039;localityName&#039;&#039;&#039; (not valid in MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| Country&lt;br /&gt;
| The name of the attribute that holds the country of your users in your LDAP server. This is usully &#039;&#039;&#039;c&#039;&#039;&#039; or &#039;&#039;&#039;countryName&#039;&#039;&#039; (not valid in MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Language&lt;br /&gt;
| &#039;&#039;&#039;preferredLanguage&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Description&lt;br /&gt;
| &#039;&#039;&#039;description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Webpage&lt;br /&gt;
| &amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ID Number&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Institution&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Department&lt;br /&gt;
| The name of the attribute that holds the department name of your users in your LDAP server. This is usully &#039;&#039;&#039;departmentNumber&#039;&#039;&#039; (for posixAccount and maybe eDirectory) or &#039;&#039;&#039;department&#039;&#039;&#039; (for MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Phone 1&lt;br /&gt;
| The name of the attribute that holds the telephone number of your users in your LDAP server. This is usually &#039;&#039;&#039;telephoneNumber&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Phone 2&lt;br /&gt;
|  The name of the attribute that holds an additional telephone number of your users in your LDAP server. This can be &#039;&#039;&#039;homePhone&#039;&#039;&#039;, &#039;&#039;&#039;mobile&#039;&#039;&#039;, &#039;&#039;&#039;pager&#039;&#039;&#039;, &#039;&#039;&#039;facsimileTelephoneNumber&#039;&#039;&#039; or even others.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Address&lt;br /&gt;
| The name of the attribute that holds the street address of your users in your LDAP server. This is usully &#039;&#039;&#039;streetAddress&#039;&#039;&#039; or &#039;&#039;&#039;street&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=====Custom User profile fields=====&lt;br /&gt;
Custom Profile Fields are now supported. &lt;br /&gt;
&lt;br /&gt;
Any user profile fields created in &#039;&#039;Site administration &amp;gt; Users &amp;gt; Accounts &amp;gt; User profile fields&#039;&#039; should now automatically show up at the end of the Data mapping field list after the &#039;&#039;&#039;Address&#039;&#039;&#039; field. See example: [[File:ldapcustomuserprofilefields.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
===Setting up regular automatic synchronisation using schedule task===&lt;br /&gt;
There is a default scheduled task to synchronize your moodle with a LDAP server. The task &#039;&#039;&#039;LDAP users sync job \auth_ldap\task\sync_task&#039;&#039;&#039;  is responsible for create, update user information, suspend and delete all LDAP accounts automatically. &lt;br /&gt;
The scheduled task can be enabled and configured on Site Administration &amp;gt; Server &amp;gt; Scheduled tasks by clicking on the gear icon. Select the desired frequency of running and enable the task, un-checking the Disabled checkbox.&lt;br /&gt;
It is important, however, to make sure that all of the above LDAP settings are working properly before you try this, as well as backing up your database and moodledata folders. Poor LDAP configuration could lead to users being wrongly deleted.&lt;br /&gt;
&lt;br /&gt;
If you find that the script is not running through all of your users properly and you have over 1000 users in each LDAP container, this is because by default some LDAP stores such as MS AD only send back 1000 users at a time and PHP versions prior to 5.4 did not implement paged support for LDAP results. If you upgrade to PHP 5.4 or higher then Moodle will obtain all your users correctly. If you can&#039;t upgrade to PHP 5.4 you may be able to follow the instructions [http://support.microsoft.com/kb/315071 here] to set the Active Directory MaxPageSize setting to a number higher than your total number of users (both now and in future) to fix it. This is a forest-wide setting.&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
==Active Directory help==&lt;br /&gt;
[[Active Directory]] is Microsoft&#039;s directory service. It is included in Windows 2000 Server and later versions of their operating system. For more information about subjects below, &#039;&#039;&#039;[[Active Directory|please go here]]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
*Warning: The PHP LDAP module does not seem to be present&lt;br /&gt;
*LDAP-module cannot connect any LDAP servers &lt;br /&gt;
*Getting correct CNs for Contexts and Creators&lt;br /&gt;
*Getting the right user_attribute&lt;br /&gt;
*Installing ldp.exe Server Tool&lt;br /&gt;
*Example Active Directory Configuration&lt;br /&gt;
*Child Domains and the Global Catalog in MS Active Directory&lt;br /&gt;
*Enabling the Global Catalog&lt;br /&gt;
*Active Directory with Moodle 1.8&lt;br /&gt;
*MS Active Directory + SSL&lt;br /&gt;
&lt;br /&gt;
==Advanced Scenarios - Multiple servers or locations==&lt;br /&gt;
For larger installations with  multiple LDAP servers, or multiple locations (contexts) in a LDAP tree.&lt;br /&gt;
&lt;br /&gt;
===Making your LDAP directory connection resilient===&lt;br /&gt;
* Entering more than one name in the ldap_host_url field can provide some sort of resilience to your system. Simply use the syntax:&lt;br /&gt;
&lt;br /&gt;
 ldap://my.first.server; ldap://my.second.server; ...&lt;br /&gt;
&lt;br /&gt;
Of course, this will only work if all the servers share the same directory information, if using eDirectory you would need to ensure your servers have viability of all relevant tree partitions, or if using Active Directory the servers are holding the same information you need though replication - see notes on a multi-domain environment if this applies.&lt;br /&gt;
&lt;br /&gt;
There is one drawback in Moodle 1.5 - 1.6 implementation of LDAP authentication : the auth_ldap_connect() function processes the servers sequentially, not in a round robin mode. Thus, if the primary server fails, you will have to wait for the connection to time out before switching to the following one.&lt;br /&gt;
&lt;br /&gt;
See also: [http://moodle.org/mod/forum/discuss.php?d=17198 Using multiple LDAP servers - Our students are on separate domain discussion on the Using Moodle forum.&lt;br /&gt;
&lt;br /&gt;
===Using a multi-domain AD environment===&lt;br /&gt;
* If you&#039;re running Active Directory with multiple domains and you have users in more then one domain you will want to configure Moodle to look at your Global Catalog server. Specifically your top level domain Global Catalog server. Here is a simple example of this kind of Active Directory layout:&lt;br /&gt;
&lt;br /&gt;
 my.domain.ca (Root AD Domain)&lt;br /&gt;
 | - dc1.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - dc2.my.domain.ca (Domain Controller)&lt;br /&gt;
 |&lt;br /&gt;
 | - - students.my.domain.ca (Sub AD Domain)&lt;br /&gt;
 | - - - dc1.students.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - - - dc2.students.my.domain.ca (Domain Controller)&lt;br /&gt;
 |&lt;br /&gt;
 | - - faculty.my.domain.ca (Sub AD Domain)&lt;br /&gt;
 | - - - dc1.faculty.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - - - dc2.faculty.my.domain.ca (Domain Controller)&lt;br /&gt;
 &lt;br /&gt;
In this example we have our top level domain (my.domain.ca) and two sub-domains. One sub-domain is for faculty accounts (faculty.my.domain.ca) and the other is for student accounts (students.my.domain.ca). Listed under each of those are two domain controllers.&lt;br /&gt;
&lt;br /&gt;
Using the above example you&#039;ll want to use the following for accessing the Global Catalog over SSL:&lt;br /&gt;
&lt;br /&gt;
 ldaps://my.domain.ca:3269/&lt;br /&gt;
&lt;br /&gt;
If you prefer to access your global catalog over a non-SSL connection you&#039;ll want to use:&lt;br /&gt;
&lt;br /&gt;
 ldap://my.domain.ca:3268/&lt;br /&gt;
 &lt;br /&gt;
We found if you didn&#039;t configure things this way you&#039;d get errors like:&lt;br /&gt;
&lt;br /&gt;
  [Thu May 26 15:23:53 2011] [error] [client 192.168.xxx.xxx] PHP Warning:  ldap_search() [&amp;lt;a href=&#039;function.ldap-search&#039;&amp;gt;function.ldap-search&amp;lt;/a&amp;gt;]: Search: Partial results and referral received in /xxx/xxx/moodle20/lib/ldaplib.php on line 241, referer: http://moodle.my.domain.ca/moodle20/login/index.php&lt;br /&gt;
  [Thu May 26 15:23:53 2011] [error] [client 192.168.xxx.xxx] PHP Warning:  ldap_first_entry(): supplied argument is not a valid ldap result resource in /xxx/xxx/moodle20/lib/ldaplib.php on line 248, referer: http://moodle.my.domain.ca/moodle20/login/index.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Using multiple user locations (contexts) in your LDAP tree===&lt;br /&gt;
There is no need to use multiple user locations if your directory tree is flat, i.e. if all user accounts reside in a &#039;&#039;&#039;ou=people,dc=my,dc=organization,dc=domain&#039;&#039;&#039; or &#039;&#039;&#039;ou=people,o=myorg&#039;&#039;&#039; container. &lt;br /&gt;
&lt;br /&gt;
At the opposite, if you use the ACL mecanism to delegate user management, there are chances that your users will be stored in containers like &#039;&#039;&#039;ou=students,ou=dept1,o=myorg&#039;&#039;&#039; and &#039;&#039;&#039;ou=students,ou=dept2,o=myorg&#039;&#039;&#039; ...&lt;br /&gt;
&lt;br /&gt;
Then there is an alternative :&lt;br /&gt;
* Look at the &#039;&#039;&#039;o=myorg&#039;&#039;&#039; level with the ldap_search_sub attribute set to &#039;&#039;&#039;yes&#039;&#039;&#039;.&lt;br /&gt;
* Set the ldap_context to &#039;&#039;&#039;ou=students,ou=dept1,o=myorg ; ou=students,ou=dept2,o=myorg&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Choosing between these two solutions supposes some sort of benchmarking, as the result depends heavily on the structure of your directory tree &#039;&#039;&#039;and&#039;&#039;&#039; on your LDAP software indexing capabilities. Simply note that there is a probability in such deep trees that two users share the same &#039;&#039;common name&#039;&#039; (cn), while having different &#039;&#039;distinguished names&#039;&#039;. Then only the second solution will have a deterministic result (returning allways the same user).&lt;br /&gt;
&lt;br /&gt;
===Using LDAPS (LDAP over SSL)===&lt;br /&gt;
====Enabling LDAPS on your directory server====&lt;br /&gt;
&lt;br /&gt;
* [[Active_Directory#MS_Active_Directory_.2B_SSL|Enabling LDAPS on MS Active Directory ]]&lt;br /&gt;
&lt;br /&gt;
====Enabling LDAPS on your Moodle server====&lt;br /&gt;
Enabling LDAPS on your server can be tricky and often it is hard to pinpoint where things are going wrong. There are also differences between Windows and Linux and even different versions and distributions of Linux. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;If you have not done so already you will need to decide upon your approach to establishing an SSL connection to your directory server:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* SSL connection with unverified self-signed certificate.&lt;br /&gt;
&lt;br /&gt;
You can generate your own SSL certificate, and then instruct your Moodle server to ignore the fact that it is not valid. This setup is not as secure as others since you cannot be sure the server you are connecting to is not fake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* SSL connection with trusted self-signed certificate.&lt;br /&gt;
&lt;br /&gt;
You can generate your own SSL certificate on your directory server, and then specifically trust this certificate by installing it on your Moodle server. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* SSL connection with verified certificate from Internet-trusted certificate authority (CA)&lt;br /&gt;
&lt;br /&gt;
In this approach the LDAP server has an installed certificate from an Internet-based CA, this means that your directory server would have an Internet address &amp;amp; host name. Your Moodle server must be trusting the certificate authority and have Internet access. This approach is not often used as it usually incurs a cost for the certificate, and it requires your directory server and Moodle server to be exposed to the Internet.&lt;br /&gt;
&lt;br /&gt;
==Linux servers==&lt;br /&gt;
&#039;&#039;&#039;These instructions are for establishing a link using a trusted self-signed certificate.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: written for a Red Hat Enterprise Linux 6 server, other Linux distributions may differ, especially in the location of the SSL certificates and OpenLdap config files, but the core principals are the same.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check that your directory server is online and accepting SSL connections on your LDAPS port (636), you can use try:&lt;br /&gt;
 openssl s_client –connect &amp;lt;ldap server ip address&amp;gt;:636&lt;br /&gt;
&lt;br /&gt;
Get your directory server’s certificate (.crt) and upload to Moodle server&#039;s ssl certificate directory, on RHEL6 this is at &#039;&#039;&#039;/etc/ssl/certs&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Convert your ‘DER’ X509 certificate into a ‘PEM’ public key certificate.&lt;br /&gt;
 openssl x509 -in my_server_certificate.cer -inform DER -out my_server_certificate.pem -outform PEM&lt;br /&gt;
&lt;br /&gt;
Create certificate hashes using c_rehash&lt;br /&gt;
 c_rehash&lt;br /&gt;
&#039;&#039;If c_rehash is not installed install with: yum install /usr/bin/c_rehash&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ensure you are able to access your LDAPS server by a DNS name, this may mean adding an entry to your host file (/etc/hosts)&lt;br /&gt;
 &amp;lt;ldap server ip address&amp;gt;    my_server.mydomain.school&lt;br /&gt;
&lt;br /&gt;
Verify your certificate to check that it is installed correctly&lt;br /&gt;
 openssl verify -verbose -CApath /etc/ssl/certs /etc/ssl/certs/my_server_certificate.pem&lt;br /&gt;
 /etc/ssl/certs/my_server_certificate.pem: OK&lt;br /&gt;
&lt;br /&gt;
You should now be able to connect to your LDAPS server over SSL without any errors&lt;br /&gt;
 openssl s_client –connect &amp;lt;ldap server DNS name&amp;gt;:636&lt;br /&gt;
&lt;br /&gt;
Edit your OpenLDAP config, on RHEL6 this is located at &#039;&#039;&#039;/etc/openldap/ldap.conf&#039;&#039;&#039;&lt;br /&gt;
 # Define location of a CA Cert&lt;br /&gt;
 TLS_CACERT /etc/ssl/certs/my_server_certificate.pem&lt;br /&gt;
 TLS_CACERTDIR /etc/ssl/certs&lt;br /&gt;
&lt;br /&gt;
Finally, you may or may not need to restart Apache, before configuring Moodle to use ldaps://&amp;lt;server DNS name&amp;gt;&lt;br /&gt;
 httpd -k restart&lt;br /&gt;
&lt;br /&gt;
==Windows servers==&lt;br /&gt;
&#039;&#039;&#039;These instructions are for establishing a link using an unverified self-signed certificate&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can tell PHP&#039;s OpenLDAP extension to disable SSL server certificate checking to do this you must create a directory called &#039;&#039;&#039;&#039;C:\OpenLDAP\sysconf\&#039;&#039;&#039;&#039; In this directory, create a file called &#039;&#039;ldap.conf&#039;&#039; with the following content:&lt;br /&gt;
&lt;br /&gt;
 TLS_REQCERT never&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;(If you are using certain versions of PHP 5.3.x you &#039;&#039;&#039;may need to place the file at other locations&#039;&#039;&#039;, [http://bugs.php.net/bug.php?id=48866 see PHP bug #48866])&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now you should be able to use &#039;&#039;&#039;ldaps://&#039;&#039;&#039; when connecting to your LDAP server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
==Appendices==&lt;br /&gt;
&lt;br /&gt;
=== Setting Resource Limits RedHat Directory Server ===&lt;br /&gt;
&lt;br /&gt;
Operational attributes can be set for the bind user DN using the command-line. &lt;br /&gt;
One can simply use ldapmodify to add the following attributes:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Attribute Name &lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| nsLookThroughLimit&lt;br /&gt;
| Specifies how many entries are examined for a search operation. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsSizeLimit &lt;br /&gt;
| Specifies the maximum number of entries the server returns to a client application in response to a search operation. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsTimeLimit &lt;br /&gt;
| Specifies the maximum time the server spends processing a search operation. Giving this attribute a value of -1 indicates that there is no time limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsIdleTimeout 	        &lt;br /&gt;
| Specifies the time a connection to the server can be idle before the connection is dropped. The value is given in seconds. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; LDAP Console Command-Line&lt;br /&gt;
&lt;br /&gt;
 ldapmodify -h redhat_dir_server -p 389 -D &amp;quot;cn=directory manager&amp;quot; -w secretpwd&lt;br /&gt;
&lt;br /&gt;
 dn: uid=MoodleAdmin,ou=system,dc=myschool,dc=edu&lt;br /&gt;
 changetype: modify&lt;br /&gt;
 add:nsSizeLimit&lt;br /&gt;
 nsSizeLimit: 1000&lt;br /&gt;
 &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[NTLM_authentication]]&lt;br /&gt;
* [[Active_Directory]]&lt;br /&gt;
* [[LDAP enrolment]]&lt;br /&gt;
* [http://download.moodle.org/download.php/docs/en/how-to_guides/ldap_auth_and_enrolment_set-up.pdf LDAP auth and enrolment set-up guide] (PDF 227KB)&lt;br /&gt;
&lt;br /&gt;
Using Moodle:&lt;br /&gt;
* [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=32168 PHP LDAP module does not seem to be present] forum discussion&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=140901 Syncronisation with AUTH_LDAP_SYNC_USERS.PHP produces fewer accounts than it should] forum discussion&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=17198 Using multiple LDAP servers] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[es:LDAP_authentication]]&lt;br /&gt;
[[fr:Utiliser un serveur LDAP]]&lt;br /&gt;
[[ja:LDAP認証]]&lt;br /&gt;
[[de:LDAP-Server]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=LDAP_authentication&amp;diff=120978</id>
		<title>LDAP authentication</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=LDAP_authentication&amp;diff=120978"/>
		<updated>2015-11-03T06:17:38Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* User lookup settings */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
Location: Settings link in &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage authentication&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This document describes how to set up Lightweight Directory Access Protocol (LDAP) authentication in Moodle.  We cover the basic, advanced and some trouble shooting sections to assist the user in the installation and administrating LDAP in Moodle.  &lt;br /&gt;
==Table of Contents==&lt;br /&gt;
__TOC__&lt;br /&gt;
==Basic Scenario==&lt;br /&gt;
The simple and straightforward approach  for most installations.&lt;br /&gt;
&lt;br /&gt;
===Assumptions===&lt;br /&gt;
&lt;br /&gt;
# Your Moodle site is located at &#039;&#039;&#039;http://your.moodle.site/&#039;&#039;&#039;&lt;br /&gt;
# You have configured your PHP installation with the LDAP extension. It is loaded and activated, and it shows when you go to &#039;&#039;&#039;http://your.moodle.site/admin/phpinfo.php&#039;&#039;&#039; (logged in as user &#039;admin&#039;).&lt;br /&gt;
# Your LDAP server has &#039;&#039;&#039;192.168.1.100&#039;&#039;&#039; as its IP address.&lt;br /&gt;
# You are not using LDAP with SSL (also known as LDAPS) in your settings. This might prevent certain operations from working (e.g., you cannot update data if you are using MS Active Directory -- MS-AD from here on --), but should be OK if you just want to authenticate your users.&lt;br /&gt;
# You don&#039;t want your users to change their passwords the first time they log in into Moodle.&lt;br /&gt;
# You are using a single domain as the source of your authentication data in case you are using MS-AD (more on this in the Appendices).&lt;br /&gt;
# You are using a top level distinguished name (DN) of &#039;&#039;&#039;dc=my,dc=organization,dc=domain&#039;&#039;&#039; as the root of your LDAP tree. &lt;br /&gt;
# You have a non-privileged LDAP user account you will use to bind to the LDAP server. This is not necessary with certain LDAP servers, but MS-AD requires this and it won&#039;t hurt if you use it even if your LDAP server doesn&#039;t need it. Make sure &#039;&#039;&#039;this account and its password don&#039;t expire&#039;&#039;&#039;, and make this password as strong as possible. Remember you only need to type this password once, when configuring Moodle, so don&#039;t be afraid of making it as hard to guess as possible. Let&#039;s say this user account has a DN of &#039;&#039;&#039;cn=ldap-user,dc=my,dc=organization,dc=domain&#039;&#039;&#039;, and password &#039;&#039;&#039;hardtoguesspassword&#039;&#039;&#039;.&lt;br /&gt;
# All of your Moodle users are in an organizational unit (OU) called &#039;&#039;&#039;moodleusers&#039;&#039;&#039;, which is right under your LDAP root. That OU has a DN of &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039;.&lt;br /&gt;
# You &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; want your LDAP users&#039; passwords to be stored in Moodle at all.&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
===Configuring Moodle authentication===&lt;br /&gt;
&lt;br /&gt;
Log in as an admin user and go to &#039;&#039;Administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage authentication&#039;&#039;. In the table that appears, enable the &amp;quot;LDAP Server&amp;quot; authentication option (click on the closed eye to make it open) and then click on the associated &#039;Settings&#039; link. You will get a page similar to this one:&lt;br /&gt;
&lt;br /&gt;
[[Image:LDAPserversettings.png|center]]&lt;br /&gt;
&lt;br /&gt;
Now, you just have to fill in the values. Let&#039;s go step by step.&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====LDAP Server Settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Host URL&lt;br /&gt;
| As the IP of your LDAP server is 192.168.1.100, type &amp;quot;&#039;&#039;&#039;ldap://192.168.1.100&#039;&#039;&#039;&amp;quot; (without the quotes), or just &amp;quot;&#039;&#039;&#039;192.168.1.100&#039;&#039;&#039;&amp;quot; (some people have trouble connecting with the first syntax, specially on MS Windows servers).&lt;br /&gt;
|-&lt;br /&gt;
| Version&lt;br /&gt;
| Unless you are using a really old LDAP server, &#039;&#039;&#039;version 3&#039;&#039;&#039; is the one you should choose.&lt;br /&gt;
|-&lt;br /&gt;
| LDAP Encoding&lt;br /&gt;
| Specify encoding used by LDAP server. Most probably utf-8.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Bind settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Don&#039;t cache passwords&lt;br /&gt;
| As you &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; want to store the users&#039;s password in Moodle&#039;s database, choose &#039;&#039;&#039;Yes&#039;&#039;&#039; here.&lt;br /&gt;
|-&lt;br /&gt;
| Distinguished Name&lt;br /&gt;
| This is the distinguished name of the bind user defined above. Just type &amp;quot;&#039;&#039;&#039;cn=ldap-user,dc=my,dc=organization,dc=domain&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|-&lt;br /&gt;
| Password&lt;br /&gt;
| This is the bind user password defined above. Type &amp;quot;&#039;&#039;&#039;hardtoguesspassword&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====User lookup settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| User type&lt;br /&gt;
| Choose: &lt;br /&gt;
* &#039;&#039;&#039;Novel Edirectory&#039;&#039;&#039; if your LDAP server is running Novell&#039;s eDdirectory.&lt;br /&gt;
* &#039;&#039;&#039;posixAccount (rfc2307)&#039;&#039;&#039; if your LDAP server is running a RFC-2307 compatible LDAP server (choose this is your server is running OpenLDAP, including Mac OS X server).&lt;br /&gt;
* &#039;&#039;&#039;posixAccount (rfc2307bis)&#039;&#039;&#039; if your LDAP server is running a RFC-2307bis compatible LDAP server.&lt;br /&gt;
* &#039;&#039;&#039;sambaSamAccount (v.3.0.7)&#039;&#039;&#039; if your LDAP server is running with SAMBA&#039;s 3.x LDAP schema extension and you want to use it.&lt;br /&gt;
* &#039;&#039;&#039;MS ActiveDirectory&#039;&#039;&#039; if your LDAP server is running Microsoft&#039;s Active Directory (MS-AD)&lt;br /&gt;
|-&lt;br /&gt;
| Contexts&lt;br /&gt;
| The DN of the context (container) where all of your Moodle users are found. Type &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; here.  &lt;br /&gt;
&lt;br /&gt;
On a Mac OS X Server, this is usually &#039;&#039;&#039;cn=users,dc=my,dc=organization,dc=domain&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Search subcontexts&lt;br /&gt;
| If you have any sub organizational units (subcontexts) hanging from &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; and you want Moodle to search there too, set this to &#039;&#039;&#039;yes&#039;&#039;&#039;. Otherwise, set this to &#039;&#039;&#039;no&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Dereference aliases&lt;br /&gt;
| Sometimes your LDAP server will tell you that the real value you are searching for is in fact in another part of the LDAP tree (this is called an alias). If you want Moodle to &#039;dereference&#039; the alias and fetch the real value from the original location, set this to &#039;&#039;&#039;yes&#039;&#039;&#039;. If you don&#039;t want Moodle to dereference it, set this to &#039;&#039;&#039;no&#039;&#039;&#039;. If you are using MS-AD, set this to &#039;&#039;&#039;no&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| User attribute&lt;br /&gt;
| The attribute used to name/search users in your LDAP tree. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you chose above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in&amp;lt;/u&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
By the way, it&#039;s usually &#039;&#039;&#039;cn&#039;&#039;&#039; (Novell eDirectory and MS-AD) or &#039;&#039;&#039;uid&#039;&#039;&#039; (RFC-2037, RFC-2037bis and SAMBA 3.x LDAP extension), but if you are using MS-AD you could (and have to, if you intend to use NTLM SSO) use &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039; (the pre-Windows 2000 logon account name) if you need too.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Correction&#039;&#039;&#039;: With MS-AD &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039; should be used anyway. With default value (&#039;&#039;&#039;cn&#039;&#039;&#039;) AD users will have to login with full name / password (Username: &#039;&#039;&#039;John Doe&#039;&#039;&#039;, Password: &#039;&#039;&#039;john&#039;s_pass&#039;&#039;&#039;). If you want to enable your users to login with domain username instead (Username: &#039;&#039;&#039;johnd&#039;&#039;&#039; Password: &#039;&#039;&#039;john&#039;s_pass&#039;&#039;&#039;), you should use &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039;. Sadly, but logging in with DOMAIN\user or user@domain.com will not work anyway.&lt;br /&gt;
&lt;br /&gt;
Note: You may wish to consider allowing extended characters in usernames in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Security &amp;gt; [[Site policies]]&#039;&#039;. &lt;br /&gt;
|-&lt;br /&gt;
| Member attribute&lt;br /&gt;
| The attribute used to list the members of a given group. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By the way, the usual values are &#039;&#039;&#039;member&#039;&#039;&#039; and &#039;&#039;&#039;memberUid&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Member attribute uses dn&lt;br /&gt;
| Whether the member attribute contains distinguished names (1) or not (0).This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Object class&lt;br /&gt;
| The type of LDAP object used to search for users. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you chose above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
* If you leave it blank, the default value based on the &#039;&#039;User type&#039;&#039; selected above will be used (see below)&lt;br /&gt;
* If you provide &amp;quot;objectClass=some-string&amp;quot;, then it will provide &amp;quot;(objectClass=some-string)&amp;quot; as the filter.&lt;br /&gt;
* If you provide a value that does not start with &amp;quot;(&amp;quot;, it is assumed to be a value that should be set to &amp;quot;objectClass&amp;quot;. So if you provide &amp;quot;some-string&amp;quot;, then it will provide &amp;quot;(objectClass=some-string)&amp;quot; as the filter.&lt;br /&gt;
* If you provide a string that starts with a &amp;quot;(&amp;quot;, then it will pass that as is. So if you provide &amp;quot;(&amp;amp;(objectClass=user)(enabledMoodleUser=1))&amp;quot;, then it will pass that as the filter.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: In the last case, that feature can be used on interactive logins,&lt;br /&gt;
&lt;br /&gt;
Here are the default values for each of the &#039;&#039;ldap_user_type&#039;&#039; values:&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=user)&#039;&#039;&#039; for Novel eDirectory&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=posixAccount)&#039;&#039;&#039; for RFC-2037 and RFC-2037bis&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=sambaSamAccount)&#039;&#039;&#039; for SAMBA 3.0.x LDAP extension&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=user)&#039;&#039;&#039; for MS-AD&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=*)&#039;&#039;&#039; for Default&lt;br /&gt;
If you get an error about a problem with updating the ldap server (even if you have specified not to write changes back to the ldap server) try setting the ldap object class to * - see http://moodle.org/mod/forum/discuss.php?d=70566 for a discussion on this problem&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Force change password====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Force change password&lt;br /&gt;
| &#039;&#039;&#039;NOTE: This setting is only used when creating your users with the cli/sync_users.php script. It&#039;s not used if your users are created as part of their first login to moodle&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Set this to &#039;&#039;Yes&#039;&#039; if you want to force your users to change their password on the first login into Moodle. Otherwise, set this to &#039;&#039;no&#039;&#039;. Bear in mind the password they are forced to change is the one stored in your LDAP server.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;As you don&#039;t want your users to change their passwords in their first login, leave this set to &#039;&#039;No&#039;&#039;&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Use standard Change Password Page&lt;br /&gt;
|&lt;br /&gt;
* Setting this to &#039;&#039;Yes&#039;&#039; makes Moodle use its own standard password change page, everytime users want to change their passwords.&lt;br /&gt;
* Setting this to &#039;&#039;No&#039;&#039; makes Moodle use the the page specified in the field called &amp;quot;Password change URL&amp;quot; (see below).&lt;br /&gt;
&lt;br /&gt;
Bear in mind that changing your LDAP passwords from Moodle might require a LDAPS connection (this is actually a requirement for MS-AD). In addition to that, the bind user specified above must have the rights needed to change other users&#039; passwords.&lt;br /&gt;
&lt;br /&gt;
Also, code for changing passwords from Moodle for anything but Novell eDirectory and Active Directory is almost not tested, so this may or may not work for other LDAP servers.&lt;br /&gt;
|-&lt;br /&gt;
| Password Format&lt;br /&gt;
| Specify how the new password is encrypted before sending it to the LDAP server: Plain text, MD5 hash or SHA-1 hash. MS-AD uses plain text, for example.&lt;br /&gt;
|-&lt;br /&gt;
| Password change URL&lt;br /&gt;
| Here you can specify a location at which your users can recover or change their username/password if they&#039;ve forgotten it. This will be provided to users as a button on the login page and their user page. if you leave this blank the button will not be printed.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====LDAP password expiration settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Expiration&lt;br /&gt;
| &lt;br /&gt;
* Setting this to &#039;&#039;No&#039;&#039; will make Moodle not to check if the password of the user has expired or not.&lt;br /&gt;
* Setting this to &#039;&#039;LDAP&#039;&#039; will make Moodle check if the LDAP password of the user has expired or not, and warn them a number of days before the password expires. When the password has expired, a &amp;quot;Your password has expired&amp;quot; message is displayed, and if the user is able to change their password from Moodle, they are offered the option to do so.&lt;br /&gt;
&lt;br /&gt;
Current code only deals with Novell eDirectory LDAP server and MS-AD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So unless you have Novell eDirectory server or MS-AD, choose &#039;&#039;No&#039;&#039; here.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Expiration warning&lt;br /&gt;
| This value sets how many days in advance of password expiration the user is warned that her password is about to expire.&lt;br /&gt;
|-&lt;br /&gt;
| Expiration attribute.&lt;br /&gt;
| The LDAP user attribute used to check password expiration. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Grace logins&lt;br /&gt;
| This setting is specific to Novell eDirectory. If set to &#039;&#039;Yes&#039;&#039;, enable LDAP gracelogin support. After password has expired the user can login until gracelogin count is 0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So unless you have Novell eDirectory server and want to allow gracelogin support, choose &#039;&#039;No&#039;&#039; here.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Grace login attribute&lt;br /&gt;
| This setting is currently not used in the code (and is specific to Novell eDirectory). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Enable user creation====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Create users externally&lt;br /&gt;
| New (anonymous) users can self-create user accounts on the external LDAP server and confirm them via email. If you enable this, remember to also configure module-specific options for user creation and to fill in some instructions in &#039;&#039;auth_instructions&#039;&#039; field in Administration &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication &amp;gt;&amp;gt; Manage authentication. Otherwise the new users won&#039;t be able to self-create new accounts.&lt;br /&gt;
&lt;br /&gt;
Only Novell eDirectory and MS-AD can create users externally (prior to Moodle 2.x). From Moodle 2.0 on, you can also create users in RFC-2307 compliant servers. &lt;br /&gt;
|-&lt;br /&gt;
| Context for new users&lt;br /&gt;
| Specify the context where users are created. This context should be different from other users&#039; contexts to prevent security issues. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Course creation====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Creators&lt;br /&gt;
| The DN of the group that contains all of your Moodle creators. This is typically a posixGroup with a &amp;quot;memberUid&amp;quot; attribute for each user you want to be a creator.  If your group is called &#039;&#039;creators&#039;&#039;, type &#039;&#039;&#039;cn=creators,ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; here.  Each memberUid attribute contains the CN of a user who is authorized to be a creator.  Do not use the user&#039;s full DN (e.g.,  not &#039;&#039;&#039;memberUid: cn=JoeTeacher,ou=moodleusers,dc-my,dc=organizations,dc=domain&#039;&#039;&#039;, but rather &#039;&#039;&#039;memberUid: JoeTeacher&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
In eDirectory, the objectClass for a group is (by default) not &#039;&#039;&#039;posixGroup&#039;&#039;&#039; but &#039;&#039;&#039;groupOfNames,&#039;&#039;&#039; whose member attribute is &#039;&#039;&#039;member,&#039;&#039;&#039; not &#039;&#039;&#039;memberUid,&#039;&#039;&#039; and whose value is the full DN of the user in question.  Although you can probably modify Moodle&#039;s code to use this field, a better solution is just to add a new &#039;&#039;&#039;objectClass&#039;&#039;&#039; attribute of &#039;&#039;&#039;posixGroup&#039;&#039;&#039; to your creators group and put the CNs for each creator in a &#039;&#039;&#039;memberUid&#039;&#039;&#039; attribute.&lt;br /&gt;
&lt;br /&gt;
In MS Active Directory, you will need to create a security group for your creators to be part of and then add them all. If your ldap context above is &#039;ou=staff,dc=my,dc=org&#039; then your group should then be &#039;cn=creators,ou=staff,dc=my,dc=org&#039;. If some of the users are from other contexts and have been added to the same security group, you&#039;ll have to add these as separate contexts after the first one using the same format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Cron synchronization script====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Removed ext user&lt;br /&gt;
| Specify what to do with internal user account during mass synchronization when user was removed from external source. Only suspended users are automatically revived if they reappear in ext source.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====NTLM SSO====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Enable&lt;br /&gt;
| If you want to use NTLM SSO (see details at [[NTLM_authentication]]), choose &#039;&#039;Yes&#039;&#039; here. Otherwise, choose &#039;&#039;No&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Subnet&lt;br /&gt;
| Specify the subnets of the clients that will use NTLM SSO (see details at [[NTLM_authentication]]).&lt;br /&gt;
|-&lt;br /&gt;
| MS IE Fast Path?&lt;br /&gt;
| If all of you clients (or most of them) are using MS Internet Explorer, you can set this option to bypasses certain steps of the SSO login and speed up login times. This only works with MS Internet Explorer, but deals with other browsers in a sensible way (they are automatically sent to the plain login page).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Data Mapping====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| First name&lt;br /&gt;
| The name of the attribute that holds the first name of your users in your LDAP server. This is usually &#039;&#039;&#039;givenName&#039;&#039;&#039; or &#039;&#039;&#039;displayName&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Surname&lt;br /&gt;
| The name of the attribute that holds the surname of your users in your LDAP server. This is usually &#039;&#039;&#039;sn&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Email address&lt;br /&gt;
| The name of the attribute that holds the email address of your users in your LDAP server. This is usually &#039;&#039;&#039;mail&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| City/town&lt;br /&gt;
| The name of the attribute that holds the city/town of your users in your LDAP server. This is usully &#039;&#039;&#039;l&#039;&#039;&#039; (lowercase L) or &#039;&#039;&#039;localityName&#039;&#039;&#039; (not valid in MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| Country&lt;br /&gt;
| The name of the attribute that holds the country of your users in your LDAP server. This is usully &#039;&#039;&#039;c&#039;&#039;&#039; or &#039;&#039;&#039;countryName&#039;&#039;&#039; (not valid in MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Language&lt;br /&gt;
| &#039;&#039;&#039;preferredLanguage&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Description&lt;br /&gt;
| &#039;&#039;&#039;description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Webpage&lt;br /&gt;
| &amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ID Number&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Institution&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Department&lt;br /&gt;
| The name of the attribute that holds the department name of your users in your LDAP server. This is usully &#039;&#039;&#039;departmentNumber&#039;&#039;&#039; (for posixAccount and maybe eDirectory) or &#039;&#039;&#039;department&#039;&#039;&#039; (for MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Phone 1&lt;br /&gt;
| The name of the attribute that holds the telephone number of your users in your LDAP server. This is usually &#039;&#039;&#039;telephoneNumber&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Phone 2&lt;br /&gt;
|  The name of the attribute that holds an additional telephone number of your users in your LDAP server. This can be &#039;&#039;&#039;homePhone&#039;&#039;&#039;, &#039;&#039;&#039;mobile&#039;&#039;&#039;, &#039;&#039;&#039;pager&#039;&#039;&#039;, &#039;&#039;&#039;facsimileTelephoneNumber&#039;&#039;&#039; or even others.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Address&lt;br /&gt;
| The name of the attribute that holds the street address of your users in your LDAP server. This is usully &#039;&#039;&#039;streetAddress&#039;&#039;&#039; or &#039;&#039;&#039;street&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=====Custom User profile fields=====&lt;br /&gt;
Custom Profile Fields are now supported. &lt;br /&gt;
&lt;br /&gt;
Any user profile fields created in &#039;&#039;Site administration &amp;gt; Users &amp;gt; Accounts &amp;gt; User profile fields&#039;&#039; should now automatically show up at the end of the Data mapping field list after the &#039;&#039;&#039;Address&#039;&#039;&#039; field. See example: [[File:ldapcustomuserprofilefields.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
===Setting up regular automatic synchronisation using schedule task===&lt;br /&gt;
There is a default scheduled task to synchronize your moodle with a LDAP server. The task &#039;&#039;&#039;LDAP users sync job \auth_ldap\task\sync_task&#039;&#039;&#039;  is responsible for create, update user information, suspend and delete all LDAP accounts automatically. &lt;br /&gt;
The scheduled task can be enabled and configured on Site Administration &amp;gt; Server &amp;gt; Scheduled tasks by clicking on the gear icon. Select the desired frequency of running and enable the task, un-checking the Disabled checkbox.&lt;br /&gt;
It is important, however, to make sure that all of the above LDAP settings are working properly before you try this, as well as backing up your database and moodledata folders. Poor LDAP configuration could lead to users being wrongly deleted.&lt;br /&gt;
&lt;br /&gt;
If you find that the script is not running through all of your users properly and you have over 1000 users in each LDAP container, this is because by default some LDAP stores such as MS AD only send back 1000 users at a time and PHP versions prior to 5.4 did not implement paged support for LDAP results. If you upgrade to PHP 5.4 or higher then Moodle will obtain all your users correctly. If you can&#039;t upgrade to PHP 5.4 you may be able to follow the instructions [http://support.microsoft.com/kb/315071 here] to set the Active Directory MaxPageSize setting to a number higher than your total number of users (both now and in future) to fix it. This is a forest-wide setting.&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
==Active Directory help==&lt;br /&gt;
[[Active Directory]] is Microsoft&#039;s directory service. It is included in Windows 2000 Server and later versions of their operating system. For more information about subjects below, &#039;&#039;&#039;[[Active Directory|please go here]]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
*Warning: The PHP LDAP module does not seem to be present&lt;br /&gt;
*LDAP-module cannot connect any LDAP servers &lt;br /&gt;
*Getting correct CNs for Contexts and Creators&lt;br /&gt;
*Getting the right user_attribute&lt;br /&gt;
*Installing ldp.exe Server Tool&lt;br /&gt;
*Example Active Directory Configuration&lt;br /&gt;
*Child Domains and the Global Catalog in MS Active Directory&lt;br /&gt;
*Enabling the Global Catalog&lt;br /&gt;
*Active Directory with Moodle 1.8&lt;br /&gt;
*MS Active Directory + SSL&lt;br /&gt;
&lt;br /&gt;
==Advanced Scenarios - Multiple servers or locations==&lt;br /&gt;
For larger installations with  multiple LDAP servers, or multiple locations (contexts) in a LDAP tree.&lt;br /&gt;
&lt;br /&gt;
===Making your LDAP directory connection resilient===&lt;br /&gt;
* Entering more than one name in the ldap_host_url field can provide some sort of resilience to your system. Simply use the syntax:&lt;br /&gt;
&lt;br /&gt;
 ldap://my.first.server; ldap://my.second.server; ...&lt;br /&gt;
&lt;br /&gt;
Of course, this will only work if all the servers share the same directory information, if using eDirectory you would need to ensure your servers have viability of all relevant tree partitions, or if using Active Directory the servers are holding the same information you need though replication - see notes on a multi-domain environment if this applies.&lt;br /&gt;
&lt;br /&gt;
There is one drawback in Moodle 1.5 - 1.6 implementation of LDAP authentication : the auth_ldap_connect() function processes the servers sequentially, not in a round robin mode. Thus, if the primary server fails, you will have to wait for the connection to time out before switching to the following one.&lt;br /&gt;
&lt;br /&gt;
See also: [http://moodle.org/mod/forum/discuss.php?d=17198 Using multiple LDAP servers - Our students are on separate domain discussion on the Using Moodle forum.&lt;br /&gt;
&lt;br /&gt;
===Using a multi-domain AD environment===&lt;br /&gt;
* If you&#039;re running Active Directory with multiple domains and you have users in more then one domain you will want to configure Moodle to look at your Global Catalog server. Specifically your top level domain Global Catalog server. Here is a simple example of this kind of Active Directory layout:&lt;br /&gt;
&lt;br /&gt;
 my.domain.ca (Root AD Domain)&lt;br /&gt;
 | - dc1.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - dc2.my.domain.ca (Domain Controller)&lt;br /&gt;
 |&lt;br /&gt;
 | - - students.my.domain.ca (Sub AD Domain)&lt;br /&gt;
 | - - - dc1.students.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - - - dc2.students.my.domain.ca (Domain Controller)&lt;br /&gt;
 |&lt;br /&gt;
 | - - faculty.my.domain.ca (Sub AD Domain)&lt;br /&gt;
 | - - - dc1.faculty.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - - - dc2.faculty.my.domain.ca (Domain Controller)&lt;br /&gt;
 &lt;br /&gt;
In this example we have our top level domain (my.domain.ca) and two sub-domains. One sub-domain is for faculty accounts (faculty.my.domain.ca) and the other is for student accounts (students.my.domain.ca). Listed under each of those are two domain controllers.&lt;br /&gt;
&lt;br /&gt;
Using the above example you&#039;ll want to use the following for accessing the Global Catalog over SSL:&lt;br /&gt;
&lt;br /&gt;
 ldaps://my.domain.ca:3269/&lt;br /&gt;
&lt;br /&gt;
If you prefer to access your global catalog over a non-SSL connection you&#039;ll want to use:&lt;br /&gt;
&lt;br /&gt;
 ldap://my.domain.ca:3268/&lt;br /&gt;
 &lt;br /&gt;
We found if you didn&#039;t configure things this way you&#039;d get errors like:&lt;br /&gt;
&lt;br /&gt;
  [Thu May 26 15:23:53 2011] [error] [client 192.168.xxx.xxx] PHP Warning:  ldap_search() [&amp;lt;a href=&#039;function.ldap-search&#039;&amp;gt;function.ldap-search&amp;lt;/a&amp;gt;]: Search: Partial results and referral received in /xxx/xxx/moodle20/lib/ldaplib.php on line 241, referer: http://moodle.my.domain.ca/moodle20/login/index.php&lt;br /&gt;
  [Thu May 26 15:23:53 2011] [error] [client 192.168.xxx.xxx] PHP Warning:  ldap_first_entry(): supplied argument is not a valid ldap result resource in /xxx/xxx/moodle20/lib/ldaplib.php on line 248, referer: http://moodle.my.domain.ca/moodle20/login/index.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Using multiple user locations (contexts) in your LDAP tree===&lt;br /&gt;
There is no need to use multiple user locations if your directory tree is flat, i.e. if all user accounts reside in a &#039;&#039;&#039;ou=people,dc=my,dc=organization,dc=domain&#039;&#039;&#039; or &#039;&#039;&#039;ou=people,o=myorg&#039;&#039;&#039; container. &lt;br /&gt;
&lt;br /&gt;
At the opposite, if you use the ACL mecanism to delegate user management, there are chances that your users will be stored in containers like &#039;&#039;&#039;ou=students,ou=dept1,o=myorg&#039;&#039;&#039; and &#039;&#039;&#039;ou=students,ou=dept2,o=myorg&#039;&#039;&#039; ...&lt;br /&gt;
&lt;br /&gt;
Then there is an alternative :&lt;br /&gt;
* Look at the &#039;&#039;&#039;o=myorg&#039;&#039;&#039; level with the ldap_search_sub attribute set to &#039;&#039;&#039;yes&#039;&#039;&#039;.&lt;br /&gt;
* Set the ldap_context to &#039;&#039;&#039;ou=students,ou=dept1,o=myorg ; ou=students,ou=dept2,o=myorg&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Choosing between these two solutions supposes some sort of benchmarking, as the result depends heavily on the structure of your directory tree &#039;&#039;&#039;and&#039;&#039;&#039; on your LDAP software indexing capabilities. Simply note that there is a probability in such deep trees that two users share the same &#039;&#039;common name&#039;&#039; (cn), while having different &#039;&#039;distinguished names&#039;&#039;. Then only the second solution will have a deterministic result (returning allways the same user).&lt;br /&gt;
&lt;br /&gt;
===Using LDAPS (LDAP over SSL)===&lt;br /&gt;
====Enabling LDAPS on your directory server====&lt;br /&gt;
&lt;br /&gt;
* [[Active_Directory#MS_Active_Directory_.2B_SSL|Enabling LDAPS on MS Active Directory ]]&lt;br /&gt;
&lt;br /&gt;
====Enabling LDAPS on your Moodle server====&lt;br /&gt;
Enabling LDAPS on your server can be tricky and often it is hard to pinpoint where things are going wrong. There are also differences between Windows and Linux and even different versions and distributions of Linux. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;If you have not done so already you will need to decide upon your approach to establishing an SSL connection to your directory server:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* SSL connection with unverified self-signed certificate.&lt;br /&gt;
&lt;br /&gt;
You can generate your own SSL certificate, and then instruct your Moodle server to ignore the fact that it is not valid. This setup is not as secure as others since you cannot be sure the server you are connecting to is not fake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* SSL connection with trusted self-signed certificate.&lt;br /&gt;
&lt;br /&gt;
You can generate your own SSL certificate on your directory server, and then specifically trust this certificate by installing it on your Moodle server. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* SSL connection with verified certificate from Internet-trusted certificate authority (CA)&lt;br /&gt;
&lt;br /&gt;
In this approach the LDAP server has an installed certificate from an Internet-based CA, this means that your directory server would have an Internet address &amp;amp; host name. Your Moodle server must be trusting the certificate authority and have Internet access. This approach is not often used as it usually incurs a cost for the certificate, and it requires your directory server and Moodle server to be exposed to the Internet.&lt;br /&gt;
&lt;br /&gt;
==Linux servers==&lt;br /&gt;
&#039;&#039;&#039;These instructions are for establishing a link using a trusted self-signed certificate.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: written for a Red Hat Enterprise Linux 6 server, other Linux distributions may differ, especially in the location of the SSL certificates and OpenLdap config files, but the core principals are the same.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check that your directory server is online and accepting SSL connections on your LDAPS port (636), you can use try:&lt;br /&gt;
 openssl s_client –connect &amp;lt;ldap server ip address&amp;gt;:636&lt;br /&gt;
&lt;br /&gt;
Get your directory server’s certificate (.crt) and upload to Moodle server&#039;s ssl certificate directory, on RHEL6 this is at &#039;&#039;&#039;/etc/ssl/certs&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Convert your ‘DER’ X509 certificate into a ‘PEM’ public key certificate.&lt;br /&gt;
 openssl x509 -in my_server_certificate.cer -inform DER -out my_server_certificate.pem -outform PEM&lt;br /&gt;
&lt;br /&gt;
Create certificate hashes using c_rehash&lt;br /&gt;
 c_rehash&lt;br /&gt;
&#039;&#039;If c_rehash is not installed install with: yum install /usr/bin/c_rehash&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ensure you are able to access your LDAPS server by a DNS name, this may mean adding an entry to your host file (/etc/hosts)&lt;br /&gt;
 &amp;lt;ldap server ip address&amp;gt;    my_server.mydomain.school&lt;br /&gt;
&lt;br /&gt;
Verify your certificate to check that it is installed correctly&lt;br /&gt;
 openssl verify -verbose -CApath /etc/ssl/certs /etc/ssl/certs/my_server_certificate.pem&lt;br /&gt;
 /etc/ssl/certs/my_server_certificate.pem: OK&lt;br /&gt;
&lt;br /&gt;
You should now be able to connect to your LDAPS server over SSL without any errors&lt;br /&gt;
 openssl s_client –connect &amp;lt;ldap server DNS name&amp;gt;:636&lt;br /&gt;
&lt;br /&gt;
Edit your OpenLDAP config, on RHEL6 this is located at &#039;&#039;&#039;/etc/openldap/ldap.conf&#039;&#039;&#039;&lt;br /&gt;
 # Define location of a CA Cert&lt;br /&gt;
 TLS_CACERT /etc/ssl/certs/my_server_certificate.pem&lt;br /&gt;
 TLS_CACERTDIR /etc/ssl/certs&lt;br /&gt;
&lt;br /&gt;
Finally, you may or may not need to restart Apache, before configuring Moodle to use ldaps://&amp;lt;server DNS name&amp;gt;&lt;br /&gt;
 httpd -k restart&lt;br /&gt;
&lt;br /&gt;
==Windows servers==&lt;br /&gt;
&#039;&#039;&#039;These instructions are for establishing a link using an unverified self-signed certificate&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can tell PHP&#039;s OpenLDAP extension to disable SSL server certificate checking to do this you must create a directory called &#039;&#039;&#039;&#039;C:\OpenLDAP\sysconf\&#039;&#039;&#039;&#039; In this directory, create a file called &#039;&#039;ldap.conf&#039;&#039; with the following content:&lt;br /&gt;
&lt;br /&gt;
 TLS_REQCERT never&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;(If you are using certain versions of PHP 5.3.x you &#039;&#039;&#039;may need to place the file at other locations&#039;&#039;&#039;, [http://bugs.php.net/bug.php?id=48866 see PHP bug #48866])&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now you should be able to use &#039;&#039;&#039;ldaps://&#039;&#039;&#039; when connecting to your LDAP server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
==Appendices==&lt;br /&gt;
&lt;br /&gt;
=== Setting Resource Limits RedHat Directory Server ===&lt;br /&gt;
&lt;br /&gt;
Operational attributes can be set for the bind user DN using the command-line. &lt;br /&gt;
One can simply use ldapmodify to add the following attributes:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Attribute Name &lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| nsLookThroughLimit&lt;br /&gt;
| Specifies how many entries are examined for a search operation. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsSizeLimit &lt;br /&gt;
| Specifies the maximum number of entries the server returns to a client application in response to a search operation. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsTimeLimit &lt;br /&gt;
| Specifies the maximum time the server spends processing a search operation. Giving this attribute a value of -1 indicates that there is no time limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsIdleTimeout 	        &lt;br /&gt;
| Specifies the time a connection to the server can be idle before the connection is dropped. The value is given in seconds. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; LDAP Console Command-Line&lt;br /&gt;
&lt;br /&gt;
 ldapmodify -h redhat_dir_server -p 389 -D &amp;quot;cn=directory manager&amp;quot; -w secretpwd&lt;br /&gt;
&lt;br /&gt;
 dn: uid=MoodleAdmin,ou=system,dc=myschool,dc=edu&lt;br /&gt;
 changetype: modify&lt;br /&gt;
 add:nsSizeLimit&lt;br /&gt;
 nsSizeLimit: 1000&lt;br /&gt;
 &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[NTLM_authentication]]&lt;br /&gt;
* [[Active_Directory]]&lt;br /&gt;
* [[LDAP enrolment]]&lt;br /&gt;
* [http://download.moodle.org/download.php/docs/en/how-to_guides/ldap_auth_and_enrolment_set-up.pdf LDAP auth and enrolment set-up guide] (PDF 227KB)&lt;br /&gt;
&lt;br /&gt;
Using Moodle:&lt;br /&gt;
* [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=32168 PHP LDAP module does not seem to be present] forum discussion&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=140901 Syncronisation with AUTH_LDAP_SYNC_USERS.PHP produces fewer accounts than it should] forum discussion&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=17198 Using multiple LDAP servers] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[es:LDAP_authentication]]&lt;br /&gt;
[[fr:Utiliser un serveur LDAP]]&lt;br /&gt;
[[ja:LDAP認証]]&lt;br /&gt;
[[de:LDAP-Server]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=LDAP_authentication&amp;diff=120977</id>
		<title>LDAP authentication</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=LDAP_authentication&amp;diff=120977"/>
		<updated>2015-11-03T06:10:54Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* Setting up regular automatic synchronisation using cron */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
Location: Settings link in &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage authentication&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This document describes how to set up Lightweight Directory Access Protocol (LDAP) authentication in Moodle.  We cover the basic, advanced and some trouble shooting sections to assist the user in the installation and administrating LDAP in Moodle.  &lt;br /&gt;
==Table of Contents==&lt;br /&gt;
__TOC__&lt;br /&gt;
==Basic Scenario==&lt;br /&gt;
The simple and straightforward approach  for most installations.&lt;br /&gt;
&lt;br /&gt;
===Assumptions===&lt;br /&gt;
&lt;br /&gt;
# Your Moodle site is located at &#039;&#039;&#039;http://your.moodle.site/&#039;&#039;&#039;&lt;br /&gt;
# You have configured your PHP installation with the LDAP extension. It is loaded and activated, and it shows when you go to &#039;&#039;&#039;http://your.moodle.site/admin/phpinfo.php&#039;&#039;&#039; (logged in as user &#039;admin&#039;).&lt;br /&gt;
# Your LDAP server has &#039;&#039;&#039;192.168.1.100&#039;&#039;&#039; as its IP address.&lt;br /&gt;
# You are not using LDAP with SSL (also known as LDAPS) in your settings. This might prevent certain operations from working (e.g., you cannot update data if you are using MS Active Directory -- MS-AD from here on --), but should be OK if you just want to authenticate your users.&lt;br /&gt;
# You don&#039;t want your users to change their passwords the first time they log in into Moodle.&lt;br /&gt;
# You are using a single domain as the source of your authentication data in case you are using MS-AD (more on this in the Appendices).&lt;br /&gt;
# You are using a top level distinguished name (DN) of &#039;&#039;&#039;dc=my,dc=organization,dc=domain&#039;&#039;&#039; as the root of your LDAP tree. &lt;br /&gt;
# You have a non-privileged LDAP user account you will use to bind to the LDAP server. This is not necessary with certain LDAP servers, but MS-AD requires this and it won&#039;t hurt if you use it even if your LDAP server doesn&#039;t need it. Make sure &#039;&#039;&#039;this account and its password don&#039;t expire&#039;&#039;&#039;, and make this password as strong as possible. Remember you only need to type this password once, when configuring Moodle, so don&#039;t be afraid of making it as hard to guess as possible. Let&#039;s say this user account has a DN of &#039;&#039;&#039;cn=ldap-user,dc=my,dc=organization,dc=domain&#039;&#039;&#039;, and password &#039;&#039;&#039;hardtoguesspassword&#039;&#039;&#039;.&lt;br /&gt;
# All of your Moodle users are in an organizational unit (OU) called &#039;&#039;&#039;moodleusers&#039;&#039;&#039;, which is right under your LDAP root. That OU has a DN of &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039;.&lt;br /&gt;
# You &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; want your LDAP users&#039; passwords to be stored in Moodle at all.&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
===Configuring Moodle authentication===&lt;br /&gt;
&lt;br /&gt;
Log in as an admin user and go to &#039;&#039;Administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage authentication&#039;&#039;. In the table that appears, enable the &amp;quot;LDAP Server&amp;quot; authentication option (click on the closed eye to make it open) and then click on the associated &#039;Settings&#039; link. You will get a page similar to this one:&lt;br /&gt;
&lt;br /&gt;
[[Image:LDAPserversettings.png|center]]&lt;br /&gt;
&lt;br /&gt;
Now, you just have to fill in the values. Let&#039;s go step by step.&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====LDAP Server Settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Host URL&lt;br /&gt;
| As the IP of your LDAP server is 192.168.1.100, type &amp;quot;&#039;&#039;&#039;ldap://192.168.1.100&#039;&#039;&#039;&amp;quot; (without the quotes), or just &amp;quot;&#039;&#039;&#039;192.168.1.100&#039;&#039;&#039;&amp;quot; (some people have trouble connecting with the first syntax, specially on MS Windows servers).&lt;br /&gt;
|-&lt;br /&gt;
| Version&lt;br /&gt;
| Unless you are using a really old LDAP server, &#039;&#039;&#039;version 3&#039;&#039;&#039; is the one you should choose.&lt;br /&gt;
|-&lt;br /&gt;
| LDAP Encoding&lt;br /&gt;
| Specify encoding used by LDAP server. Most probably utf-8.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Bind settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Don&#039;t cache passwords&lt;br /&gt;
| As you &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; want to store the users&#039;s password in Moodle&#039;s database, choose &#039;&#039;&#039;Yes&#039;&#039;&#039; here.&lt;br /&gt;
|-&lt;br /&gt;
| Distinguished Name&lt;br /&gt;
| This is the distinguished name of the bind user defined above. Just type &amp;quot;&#039;&#039;&#039;cn=ldap-user,dc=my,dc=organization,dc=domain&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|-&lt;br /&gt;
| Password&lt;br /&gt;
| This is the bind user password defined above. Type &amp;quot;&#039;&#039;&#039;hardtoguesspassword&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====User lookup settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| User type&lt;br /&gt;
| Choose: &lt;br /&gt;
* &#039;&#039;&#039;Novel Edirectory&#039;&#039;&#039; if your LDAP server is running Novell&#039;s eDdirectory.&lt;br /&gt;
* &#039;&#039;&#039;posixAccount (rfc2307)&#039;&#039;&#039; if your LDAP server is running a RFC-2307 compatible LDAP server (choose this is your server is running OpenLDAP, including Mac OS X server).&lt;br /&gt;
* &#039;&#039;&#039;posixAccount (rfc2307bis)&#039;&#039;&#039; if your LDAP server is running a RFC-2307bis compatible LDAP server.&lt;br /&gt;
* &#039;&#039;&#039;sambaSamAccount (v.3.0.7)&#039;&#039;&#039; if your LDAP server is running with SAMBA&#039;s 3.x LDAP schema extension and you want to use it.&lt;br /&gt;
* &#039;&#039;&#039;MS ActiveDirectory&#039;&#039;&#039; if your LDAP server is running Microsoft&#039;s Active Directory (MS-AD)&lt;br /&gt;
|-&lt;br /&gt;
| Contexts&lt;br /&gt;
| The DN of the context (container) where all of your Moodle users are found. Type &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; here.  &lt;br /&gt;
&lt;br /&gt;
On a Mac OS X Server, this is usually &#039;&#039;&#039;cn=users,dc=my,dc=organization,dc=domain&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Search subcontexts&lt;br /&gt;
| If you have any sub organizational units (subcontexts) hanging from &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; and you want Moodle to search there too, set this to &#039;&#039;&#039;yes&#039;&#039;&#039;. Otherwise, set this to &#039;&#039;&#039;no&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Dereference aliases&lt;br /&gt;
| Sometimes your LDAP server will tell you that the real value you are searching for is in fact in another part of the LDAP tree (this is called an alias). If you want Moodle to &#039;dereference&#039; the alias and fetch the real value from the original location, set this to &#039;&#039;&#039;yes&#039;&#039;&#039;. If you don&#039;t want Moodle to dereference it, set this to &#039;&#039;&#039;no&#039;&#039;&#039;. If you are using MS-AD, set this to &#039;&#039;&#039;no&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| User attribute&lt;br /&gt;
| The attribute used to name/search users in your LDAP tree. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you chose above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in&amp;lt;/u&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
By the way, it&#039;s usually &#039;&#039;&#039;cn&#039;&#039;&#039; (Novell eDirectory and MS-AD) or &#039;&#039;&#039;uid&#039;&#039;&#039; (RFC-2037, RFC-2037bis and SAMBA 3.x LDAP extension), but if you are using MS-AD you could (and have to, if you intend to use NTLM SSO) use &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039; (the pre-Windows 2000 logon account name) if you need too.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Correction&#039;&#039;&#039;: With MS-AD &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039; should be used anyway. With default value (&#039;&#039;&#039;cn&#039;&#039;&#039;) AD users will have to login with full name / password (Username: &#039;&#039;&#039;John Doe&#039;&#039;&#039;, Password: &#039;&#039;&#039;john&#039;s_pass&#039;&#039;&#039;). If you want to enable your users to login with domain username instead (Username: &#039;&#039;&#039;johnd&#039;&#039;&#039; Password: &#039;&#039;&#039;john&#039;s_pass&#039;&#039;&#039;), you should use &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039;. Sadly, but logging in with DOMAIN\user or user@domain.com will not work anyway.&lt;br /&gt;
&lt;br /&gt;
Note: You may wish to consider allowing extended characters in usernames in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Security &amp;gt; [[Site policies]]&#039;&#039;. &lt;br /&gt;
|-&lt;br /&gt;
| Member attribute&lt;br /&gt;
| The attribute used to list the members of a given group. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By the way, the usual values are &#039;&#039;&#039;member&#039;&#039;&#039; and &#039;&#039;&#039;memberUid&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Member attribute uses dn&lt;br /&gt;
| Whether the member attribute contains distinguished names (1) or not (0).This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Object class&lt;br /&gt;
| The type of LDAP object used to search for users. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you chose above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
* If you leave it blank, the default value based on the &#039;&#039;User type&#039;&#039; selected above will be used (see below)&lt;br /&gt;
* If you provide &amp;quot;objectClass=some-string&amp;quot;, then it will provide &amp;quot;(objectClass=some-string)&amp;quot; as the filter.&lt;br /&gt;
* If you provide a value that does not start with &amp;quot;(&amp;quot;, it is assumed to be a value that should be set to &amp;quot;objectClass&amp;quot;. So if you provide &amp;quot;some-string&amp;quot;, then it will provide &amp;quot;(objectClass=some-string)&amp;quot; as the filter.&lt;br /&gt;
* If you provide a string that starts with a &amp;quot;(&amp;quot;, then it will pass that as is. So if you provide &amp;quot;(&amp;amp;(objectClass=user)(enabledMoodleUser=1))&amp;quot;, then it will pass that as the filter.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: In the last case, there are two different places where that feature can be used:&lt;br /&gt;
* on interactive logins,&lt;br /&gt;
* on bulk account syncing, via auth/ldap/cli/sync_users.php&lt;br /&gt;
&lt;br /&gt;
Here are the default values for each of the &#039;&#039;ldap_user_type&#039;&#039; values:&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=user)&#039;&#039;&#039; for Novel eDirectory&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=posixAccount)&#039;&#039;&#039; for RFC-2037 and RFC-2037bis&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=sambaSamAccount)&#039;&#039;&#039; for SAMBA 3.0.x LDAP extension&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=user)&#039;&#039;&#039; for MS-AD&lt;br /&gt;
* &#039;&#039;&#039;(objectClass=*)&#039;&#039;&#039; for Default&lt;br /&gt;
If you get an error about a problem with updating the ldap server (even if you have specified not to write changes back to the ldap server) try setting the ldap object class to * - see http://moodle.org/mod/forum/discuss.php?d=70566 for a discussion on this problem&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Force change password====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Force change password&lt;br /&gt;
| &#039;&#039;&#039;NOTE: This setting is only used when creating your users with the cli/sync_users.php script. It&#039;s not used if your users are created as part of their first login to moodle&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Set this to &#039;&#039;Yes&#039;&#039; if you want to force your users to change their password on the first login into Moodle. Otherwise, set this to &#039;&#039;no&#039;&#039;. Bear in mind the password they are forced to change is the one stored in your LDAP server.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;As you don&#039;t want your users to change their passwords in their first login, leave this set to &#039;&#039;No&#039;&#039;&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Use standard Change Password Page&lt;br /&gt;
|&lt;br /&gt;
* Setting this to &#039;&#039;Yes&#039;&#039; makes Moodle use its own standard password change page, everytime users want to change their passwords.&lt;br /&gt;
* Setting this to &#039;&#039;No&#039;&#039; makes Moodle use the the page specified in the field called &amp;quot;Password change URL&amp;quot; (see below).&lt;br /&gt;
&lt;br /&gt;
Bear in mind that changing your LDAP passwords from Moodle might require a LDAPS connection (this is actually a requirement for MS-AD). In addition to that, the bind user specified above must have the rights needed to change other users&#039; passwords.&lt;br /&gt;
&lt;br /&gt;
Also, code for changing passwords from Moodle for anything but Novell eDirectory and Active Directory is almost not tested, so this may or may not work for other LDAP servers.&lt;br /&gt;
|-&lt;br /&gt;
| Password Format&lt;br /&gt;
| Specify how the new password is encrypted before sending it to the LDAP server: Plain text, MD5 hash or SHA-1 hash. MS-AD uses plain text, for example.&lt;br /&gt;
|-&lt;br /&gt;
| Password change URL&lt;br /&gt;
| Here you can specify a location at which your users can recover or change their username/password if they&#039;ve forgotten it. This will be provided to users as a button on the login page and their user page. if you leave this blank the button will not be printed.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====LDAP password expiration settings====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Expiration&lt;br /&gt;
| &lt;br /&gt;
* Setting this to &#039;&#039;No&#039;&#039; will make Moodle not to check if the password of the user has expired or not.&lt;br /&gt;
* Setting this to &#039;&#039;LDAP&#039;&#039; will make Moodle check if the LDAP password of the user has expired or not, and warn them a number of days before the password expires. When the password has expired, a &amp;quot;Your password has expired&amp;quot; message is displayed, and if the user is able to change their password from Moodle, they are offered the option to do so.&lt;br /&gt;
&lt;br /&gt;
Current code only deals with Novell eDirectory LDAP server and MS-AD.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So unless you have Novell eDirectory server or MS-AD, choose &#039;&#039;No&#039;&#039; here.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Expiration warning&lt;br /&gt;
| This value sets how many days in advance of password expiration the user is warned that her password is about to expire.&lt;br /&gt;
|-&lt;br /&gt;
| Expiration attribute.&lt;br /&gt;
| The LDAP user attribute used to check password expiration. This option takes a default value based on the &#039;&#039;User type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Grace logins&lt;br /&gt;
| This setting is specific to Novell eDirectory. If set to &#039;&#039;Yes&#039;&#039;, enable LDAP gracelogin support. After password has expired the user can login until gracelogin count is 0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So unless you have Novell eDirectory server and want to allow gracelogin support, choose &#039;&#039;No&#039;&#039; here.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Grace login attribute&lt;br /&gt;
| This setting is currently not used in the code (and is specific to Novell eDirectory). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Enable user creation====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Create users externally&lt;br /&gt;
| New (anonymous) users can self-create user accounts on the external LDAP server and confirm them via email. If you enable this, remember to also configure module-specific options for user creation and to fill in some instructions in &#039;&#039;auth_instructions&#039;&#039; field in Administration &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication &amp;gt;&amp;gt; Manage authentication. Otherwise the new users won&#039;t be able to self-create new accounts.&lt;br /&gt;
&lt;br /&gt;
Only Novell eDirectory and MS-AD can create users externally (prior to Moodle 2.x). From Moodle 2.0 on, you can also create users in RFC-2307 compliant servers. &lt;br /&gt;
|-&lt;br /&gt;
| Context for new users&lt;br /&gt;
| Specify the context where users are created. This context should be different from other users&#039; contexts to prevent security issues. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Course creation====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Creators&lt;br /&gt;
| The DN of the group that contains all of your Moodle creators. This is typically a posixGroup with a &amp;quot;memberUid&amp;quot; attribute for each user you want to be a creator.  If your group is called &#039;&#039;creators&#039;&#039;, type &#039;&#039;&#039;cn=creators,ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; here.  Each memberUid attribute contains the CN of a user who is authorized to be a creator.  Do not use the user&#039;s full DN (e.g.,  not &#039;&#039;&#039;memberUid: cn=JoeTeacher,ou=moodleusers,dc-my,dc=organizations,dc=domain&#039;&#039;&#039;, but rather &#039;&#039;&#039;memberUid: JoeTeacher&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
In eDirectory, the objectClass for a group is (by default) not &#039;&#039;&#039;posixGroup&#039;&#039;&#039; but &#039;&#039;&#039;groupOfNames,&#039;&#039;&#039; whose member attribute is &#039;&#039;&#039;member,&#039;&#039;&#039; not &#039;&#039;&#039;memberUid,&#039;&#039;&#039; and whose value is the full DN of the user in question.  Although you can probably modify Moodle&#039;s code to use this field, a better solution is just to add a new &#039;&#039;&#039;objectClass&#039;&#039;&#039; attribute of &#039;&#039;&#039;posixGroup&#039;&#039;&#039; to your creators group and put the CNs for each creator in a &#039;&#039;&#039;memberUid&#039;&#039;&#039; attribute.&lt;br /&gt;
&lt;br /&gt;
In MS Active Directory, you will need to create a security group for your creators to be part of and then add them all. If your ldap context above is &#039;ou=staff,dc=my,dc=org&#039; then your group should then be &#039;cn=creators,ou=staff,dc=my,dc=org&#039;. If some of the users are from other contexts and have been added to the same security group, you&#039;ll have to add these as separate contexts after the first one using the same format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Cron synchronization script====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Removed ext user&lt;br /&gt;
| Specify what to do with internal user account during mass synchronization when user was removed from external source. Only suspended users are automatically revived if they reappear in ext source.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====NTLM SSO====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| Enable&lt;br /&gt;
| If you want to use NTLM SSO (see details at [[NTLM_authentication]]), choose &#039;&#039;Yes&#039;&#039; here. Otherwise, choose &#039;&#039;No&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| Subnet&lt;br /&gt;
| Specify the subnets of the clients that will use NTLM SSO (see details at [[NTLM_authentication]]).&lt;br /&gt;
|-&lt;br /&gt;
| MS IE Fast Path?&lt;br /&gt;
| If all of you clients (or most of them) are using MS Internet Explorer, you can set this option to bypasses certain steps of the SSO login and speed up login times. This only works with MS Internet Explorer, but deals with other browsers in a sensible way (they are automatically sent to the plain login page).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
====Data Mapping====&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| First name&lt;br /&gt;
| The name of the attribute that holds the first name of your users in your LDAP server. This is usually &#039;&#039;&#039;givenName&#039;&#039;&#039; or &#039;&#039;&#039;displayName&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Surname&lt;br /&gt;
| The name of the attribute that holds the surname of your users in your LDAP server. This is usually &#039;&#039;&#039;sn&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Email address&lt;br /&gt;
| The name of the attribute that holds the email address of your users in your LDAP server. This is usually &#039;&#039;&#039;mail&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| City/town&lt;br /&gt;
| The name of the attribute that holds the city/town of your users in your LDAP server. This is usully &#039;&#039;&#039;l&#039;&#039;&#039; (lowercase L) or &#039;&#039;&#039;localityName&#039;&#039;&#039; (not valid in MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| Country&lt;br /&gt;
| The name of the attribute that holds the country of your users in your LDAP server. This is usully &#039;&#039;&#039;c&#039;&#039;&#039; or &#039;&#039;&#039;countryName&#039;&#039;&#039; (not valid in MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Language&lt;br /&gt;
| &#039;&#039;&#039;preferredLanguage&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Description&lt;br /&gt;
| &#039;&#039;&#039;description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Webpage&lt;br /&gt;
| &amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ID Number&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Institution&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Department&lt;br /&gt;
| The name of the attribute that holds the department name of your users in your LDAP server. This is usully &#039;&#039;&#039;departmentNumber&#039;&#039;&#039; (for posixAccount and maybe eDirectory) or &#039;&#039;&#039;department&#039;&#039;&#039; (for MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Phone 1&lt;br /&gt;
| The name of the attribute that holds the telephone number of your users in your LDAP server. This is usually &#039;&#039;&#039;telephoneNumber&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Phone 2&lt;br /&gt;
|  The name of the attribute that holds an additional telephone number of your users in your LDAP server. This can be &#039;&#039;&#039;homePhone&#039;&#039;&#039;, &#039;&#039;&#039;mobile&#039;&#039;&#039;, &#039;&#039;&#039;pager&#039;&#039;&#039;, &#039;&#039;&#039;facsimileTelephoneNumber&#039;&#039;&#039; or even others.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Address&lt;br /&gt;
| The name of the attribute that holds the street address of your users in your LDAP server. This is usully &#039;&#039;&#039;streetAddress&#039;&#039;&#039; or &#039;&#039;&#039;street&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=====Custom User profile fields=====&lt;br /&gt;
Custom Profile Fields are now supported. &lt;br /&gt;
&lt;br /&gt;
Any user profile fields created in &#039;&#039;Site administration &amp;gt; Users &amp;gt; Accounts &amp;gt; User profile fields&#039;&#039; should now automatically show up at the end of the Data mapping field list after the &#039;&#039;&#039;Address&#039;&#039;&#039; field. See example: [[File:ldapcustomuserprofilefields.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
===Setting up regular automatic synchronisation using schedule task===&lt;br /&gt;
There is a default scheduled task to synchronize your moodle with a LDAP server. The task &#039;&#039;&#039;LDAP users sync job \auth_ldap\task\sync_task&#039;&#039;&#039;  is responsible for create, update user information, suspend and delete all LDAP accounts automatically. &lt;br /&gt;
The scheduled task can be enabled and configured on Site Administration &amp;gt; Server &amp;gt; Scheduled tasks by clicking on the gear icon. Select the desired frequency of running and enable the task, un-checking the Disabled checkbox.&lt;br /&gt;
It is important, however, to make sure that all of the above LDAP settings are working properly before you try this, as well as backing up your database and moodledata folders. Poor LDAP configuration could lead to users being wrongly deleted.&lt;br /&gt;
&lt;br /&gt;
If you find that the script is not running through all of your users properly and you have over 1000 users in each LDAP container, this is because by default some LDAP stores such as MS AD only send back 1000 users at a time and PHP versions prior to 5.4 did not implement paged support for LDAP results. If you upgrade to PHP 5.4 or higher then Moodle will obtain all your users correctly. If you can&#039;t upgrade to PHP 5.4 you may be able to follow the instructions [http://support.microsoft.com/kb/315071 here] to set the Active Directory MaxPageSize setting to a number higher than your total number of users (both now and in future) to fix it. This is a forest-wide setting.&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
==Active Directory help==&lt;br /&gt;
[[Active Directory]] is Microsoft&#039;s directory service. It is included in Windows 2000 Server and later versions of their operating system. For more information about subjects below, &#039;&#039;&#039;[[Active Directory|please go here]]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
*Warning: The PHP LDAP module does not seem to be present&lt;br /&gt;
*LDAP-module cannot connect any LDAP servers &lt;br /&gt;
*Getting correct CNs for Contexts and Creators&lt;br /&gt;
*Getting the right user_attribute&lt;br /&gt;
*Installing ldp.exe Server Tool&lt;br /&gt;
*Example Active Directory Configuration&lt;br /&gt;
*Child Domains and the Global Catalog in MS Active Directory&lt;br /&gt;
*Enabling the Global Catalog&lt;br /&gt;
*Active Directory with Moodle 1.8&lt;br /&gt;
*MS Active Directory + SSL&lt;br /&gt;
&lt;br /&gt;
==Advanced Scenarios - Multiple servers or locations==&lt;br /&gt;
For larger installations with  multiple LDAP servers, or multiple locations (contexts) in a LDAP tree.&lt;br /&gt;
&lt;br /&gt;
===Making your LDAP directory connection resilient===&lt;br /&gt;
* Entering more than one name in the ldap_host_url field can provide some sort of resilience to your system. Simply use the syntax:&lt;br /&gt;
&lt;br /&gt;
 ldap://my.first.server; ldap://my.second.server; ...&lt;br /&gt;
&lt;br /&gt;
Of course, this will only work if all the servers share the same directory information, if using eDirectory you would need to ensure your servers have viability of all relevant tree partitions, or if using Active Directory the servers are holding the same information you need though replication - see notes on a multi-domain environment if this applies.&lt;br /&gt;
&lt;br /&gt;
There is one drawback in Moodle 1.5 - 1.6 implementation of LDAP authentication : the auth_ldap_connect() function processes the servers sequentially, not in a round robin mode. Thus, if the primary server fails, you will have to wait for the connection to time out before switching to the following one.&lt;br /&gt;
&lt;br /&gt;
See also: [http://moodle.org/mod/forum/discuss.php?d=17198 Using multiple LDAP servers - Our students are on separate domain discussion on the Using Moodle forum.&lt;br /&gt;
&lt;br /&gt;
===Using a multi-domain AD environment===&lt;br /&gt;
* If you&#039;re running Active Directory with multiple domains and you have users in more then one domain you will want to configure Moodle to look at your Global Catalog server. Specifically your top level domain Global Catalog server. Here is a simple example of this kind of Active Directory layout:&lt;br /&gt;
&lt;br /&gt;
 my.domain.ca (Root AD Domain)&lt;br /&gt;
 | - dc1.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - dc2.my.domain.ca (Domain Controller)&lt;br /&gt;
 |&lt;br /&gt;
 | - - students.my.domain.ca (Sub AD Domain)&lt;br /&gt;
 | - - - dc1.students.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - - - dc2.students.my.domain.ca (Domain Controller)&lt;br /&gt;
 |&lt;br /&gt;
 | - - faculty.my.domain.ca (Sub AD Domain)&lt;br /&gt;
 | - - - dc1.faculty.my.domain.ca (Domain Controller)&lt;br /&gt;
 | - - - dc2.faculty.my.domain.ca (Domain Controller)&lt;br /&gt;
 &lt;br /&gt;
In this example we have our top level domain (my.domain.ca) and two sub-domains. One sub-domain is for faculty accounts (faculty.my.domain.ca) and the other is for student accounts (students.my.domain.ca). Listed under each of those are two domain controllers.&lt;br /&gt;
&lt;br /&gt;
Using the above example you&#039;ll want to use the following for accessing the Global Catalog over SSL:&lt;br /&gt;
&lt;br /&gt;
 ldaps://my.domain.ca:3269/&lt;br /&gt;
&lt;br /&gt;
If you prefer to access your global catalog over a non-SSL connection you&#039;ll want to use:&lt;br /&gt;
&lt;br /&gt;
 ldap://my.domain.ca:3268/&lt;br /&gt;
 &lt;br /&gt;
We found if you didn&#039;t configure things this way you&#039;d get errors like:&lt;br /&gt;
&lt;br /&gt;
  [Thu May 26 15:23:53 2011] [error] [client 192.168.xxx.xxx] PHP Warning:  ldap_search() [&amp;lt;a href=&#039;function.ldap-search&#039;&amp;gt;function.ldap-search&amp;lt;/a&amp;gt;]: Search: Partial results and referral received in /xxx/xxx/moodle20/lib/ldaplib.php on line 241, referer: http://moodle.my.domain.ca/moodle20/login/index.php&lt;br /&gt;
  [Thu May 26 15:23:53 2011] [error] [client 192.168.xxx.xxx] PHP Warning:  ldap_first_entry(): supplied argument is not a valid ldap result resource in /xxx/xxx/moodle20/lib/ldaplib.php on line 248, referer: http://moodle.my.domain.ca/moodle20/login/index.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Using multiple user locations (contexts) in your LDAP tree===&lt;br /&gt;
There is no need to use multiple user locations if your directory tree is flat, i.e. if all user accounts reside in a &#039;&#039;&#039;ou=people,dc=my,dc=organization,dc=domain&#039;&#039;&#039; or &#039;&#039;&#039;ou=people,o=myorg&#039;&#039;&#039; container. &lt;br /&gt;
&lt;br /&gt;
At the opposite, if you use the ACL mecanism to delegate user management, there are chances that your users will be stored in containers like &#039;&#039;&#039;ou=students,ou=dept1,o=myorg&#039;&#039;&#039; and &#039;&#039;&#039;ou=students,ou=dept2,o=myorg&#039;&#039;&#039; ...&lt;br /&gt;
&lt;br /&gt;
Then there is an alternative :&lt;br /&gt;
* Look at the &#039;&#039;&#039;o=myorg&#039;&#039;&#039; level with the ldap_search_sub attribute set to &#039;&#039;&#039;yes&#039;&#039;&#039;.&lt;br /&gt;
* Set the ldap_context to &#039;&#039;&#039;ou=students,ou=dept1,o=myorg ; ou=students,ou=dept2,o=myorg&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Choosing between these two solutions supposes some sort of benchmarking, as the result depends heavily on the structure of your directory tree &#039;&#039;&#039;and&#039;&#039;&#039; on your LDAP software indexing capabilities. Simply note that there is a probability in such deep trees that two users share the same &#039;&#039;common name&#039;&#039; (cn), while having different &#039;&#039;distinguished names&#039;&#039;. Then only the second solution will have a deterministic result (returning allways the same user).&lt;br /&gt;
&lt;br /&gt;
===Using LDAPS (LDAP over SSL)===&lt;br /&gt;
====Enabling LDAPS on your directory server====&lt;br /&gt;
&lt;br /&gt;
* [[Active_Directory#MS_Active_Directory_.2B_SSL|Enabling LDAPS on MS Active Directory ]]&lt;br /&gt;
&lt;br /&gt;
====Enabling LDAPS on your Moodle server====&lt;br /&gt;
Enabling LDAPS on your server can be tricky and often it is hard to pinpoint where things are going wrong. There are also differences between Windows and Linux and even different versions and distributions of Linux. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;If you have not done so already you will need to decide upon your approach to establishing an SSL connection to your directory server:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* SSL connection with unverified self-signed certificate.&lt;br /&gt;
&lt;br /&gt;
You can generate your own SSL certificate, and then instruct your Moodle server to ignore the fact that it is not valid. This setup is not as secure as others since you cannot be sure the server you are connecting to is not fake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* SSL connection with trusted self-signed certificate.&lt;br /&gt;
&lt;br /&gt;
You can generate your own SSL certificate on your directory server, and then specifically trust this certificate by installing it on your Moodle server. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* SSL connection with verified certificate from Internet-trusted certificate authority (CA)&lt;br /&gt;
&lt;br /&gt;
In this approach the LDAP server has an installed certificate from an Internet-based CA, this means that your directory server would have an Internet address &amp;amp; host name. Your Moodle server must be trusting the certificate authority and have Internet access. This approach is not often used as it usually incurs a cost for the certificate, and it requires your directory server and Moodle server to be exposed to the Internet.&lt;br /&gt;
&lt;br /&gt;
==Linux servers==&lt;br /&gt;
&#039;&#039;&#039;These instructions are for establishing a link using a trusted self-signed certificate.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: written for a Red Hat Enterprise Linux 6 server, other Linux distributions may differ, especially in the location of the SSL certificates and OpenLdap config files, but the core principals are the same.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check that your directory server is online and accepting SSL connections on your LDAPS port (636), you can use try:&lt;br /&gt;
 openssl s_client –connect &amp;lt;ldap server ip address&amp;gt;:636&lt;br /&gt;
&lt;br /&gt;
Get your directory server’s certificate (.crt) and upload to Moodle server&#039;s ssl certificate directory, on RHEL6 this is at &#039;&#039;&#039;/etc/ssl/certs&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Convert your ‘DER’ X509 certificate into a ‘PEM’ public key certificate.&lt;br /&gt;
 openssl x509 -in my_server_certificate.cer -inform DER -out my_server_certificate.pem -outform PEM&lt;br /&gt;
&lt;br /&gt;
Create certificate hashes using c_rehash&lt;br /&gt;
 c_rehash&lt;br /&gt;
&#039;&#039;If c_rehash is not installed install with: yum install /usr/bin/c_rehash&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ensure you are able to access your LDAPS server by a DNS name, this may mean adding an entry to your host file (/etc/hosts)&lt;br /&gt;
 &amp;lt;ldap server ip address&amp;gt;    my_server.mydomain.school&lt;br /&gt;
&lt;br /&gt;
Verify your certificate to check that it is installed correctly&lt;br /&gt;
 openssl verify -verbose -CApath /etc/ssl/certs /etc/ssl/certs/my_server_certificate.pem&lt;br /&gt;
 /etc/ssl/certs/my_server_certificate.pem: OK&lt;br /&gt;
&lt;br /&gt;
You should now be able to connect to your LDAPS server over SSL without any errors&lt;br /&gt;
 openssl s_client –connect &amp;lt;ldap server DNS name&amp;gt;:636&lt;br /&gt;
&lt;br /&gt;
Edit your OpenLDAP config, on RHEL6 this is located at &#039;&#039;&#039;/etc/openldap/ldap.conf&#039;&#039;&#039;&lt;br /&gt;
 # Define location of a CA Cert&lt;br /&gt;
 TLS_CACERT /etc/ssl/certs/my_server_certificate.pem&lt;br /&gt;
 TLS_CACERTDIR /etc/ssl/certs&lt;br /&gt;
&lt;br /&gt;
Finally, you may or may not need to restart Apache, before configuring Moodle to use ldaps://&amp;lt;server DNS name&amp;gt;&lt;br /&gt;
 httpd -k restart&lt;br /&gt;
&lt;br /&gt;
==Windows servers==&lt;br /&gt;
&#039;&#039;&#039;These instructions are for establishing a link using an unverified self-signed certificate&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can tell PHP&#039;s OpenLDAP extension to disable SSL server certificate checking to do this you must create a directory called &#039;&#039;&#039;&#039;C:\OpenLDAP\sysconf\&#039;&#039;&#039;&#039; In this directory, create a file called &#039;&#039;ldap.conf&#039;&#039; with the following content:&lt;br /&gt;
&lt;br /&gt;
 TLS_REQCERT never&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;(If you are using certain versions of PHP 5.3.x you &#039;&#039;&#039;may need to place the file at other locations&#039;&#039;&#039;, [http://bugs.php.net/bug.php?id=48866 see PHP bug #48866])&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now you should be able to use &#039;&#039;&#039;ldaps://&#039;&#039;&#039; when connecting to your LDAP server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
==Appendices==&lt;br /&gt;
&lt;br /&gt;
=== Setting Resource Limits RedHat Directory Server ===&lt;br /&gt;
&lt;br /&gt;
Operational attributes can be set for the bind user DN using the command-line. &lt;br /&gt;
One can simply use ldapmodify to add the following attributes:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Attribute Name &lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| nsLookThroughLimit&lt;br /&gt;
| Specifies how many entries are examined for a search operation. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsSizeLimit &lt;br /&gt;
| Specifies the maximum number of entries the server returns to a client application in response to a search operation. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsTimeLimit &lt;br /&gt;
| Specifies the maximum time the server spends processing a search operation. Giving this attribute a value of -1 indicates that there is no time limit.&lt;br /&gt;
|-&lt;br /&gt;
| nsIdleTimeout 	        &lt;br /&gt;
| Specifies the time a connection to the server can be idle before the connection is dropped. The value is given in seconds. Giving this attribute a value of -1 indicates that there is no limit.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt; LDAP Console Command-Line&lt;br /&gt;
&lt;br /&gt;
 ldapmodify -h redhat_dir_server -p 389 -D &amp;quot;cn=directory manager&amp;quot; -w secretpwd&lt;br /&gt;
&lt;br /&gt;
 dn: uid=MoodleAdmin,ou=system,dc=myschool,dc=edu&lt;br /&gt;
 changetype: modify&lt;br /&gt;
 add:nsSizeLimit&lt;br /&gt;
 nsSizeLimit: 1000&lt;br /&gt;
 &amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[LDAP_authentication#Table of Contents|Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[NTLM_authentication]]&lt;br /&gt;
* [[Active_Directory]]&lt;br /&gt;
* [[LDAP enrolment]]&lt;br /&gt;
* [http://download.moodle.org/download.php/docs/en/how-to_guides/ldap_auth_and_enrolment_set-up.pdf LDAP auth and enrolment set-up guide] (PDF 227KB)&lt;br /&gt;
&lt;br /&gt;
Using Moodle:&lt;br /&gt;
* [http://moodle.org/mod/forum/view.php?id=42 User authentication forum]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=32168 PHP LDAP module does not seem to be present] forum discussion&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=140901 Syncronisation with AUTH_LDAP_SYNC_USERS.PHP produces fewer accounts than it should] forum discussion&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=17198 Using multiple LDAP servers] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[es:LDAP_authentication]]&lt;br /&gt;
[[fr:Utiliser un serveur LDAP]]&lt;br /&gt;
[[ja:LDAP認証]]&lt;br /&gt;
[[de:LDAP-Server]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Nginx&amp;diff=117703</id>
		<title>Nginx</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Nginx&amp;diff=117703"/>
		<updated>2015-03-26T09:07:29Z</updated>

		<summary type="html">&lt;p&gt;Lameze: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}[[Nginx]] [engine x] is an HTTP and reverse proxy server, as well as a mail proxy server, written by Igor Sysoev. The nginx project started with a strong focus on high concurrency, high performance and low memory usage. It is licensed under the 2-clause BSD-like license and it runs on Linux, BSD variants, Mac OS X, Solaris, AIX, HP-UX, as well as on other *nix flavors. It also has a proof of concept port for Microsoft Windows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The following is community-contributed documentation on Nginx configuration. Amendmends and additions are welcome.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Nginx configuration ==&lt;br /&gt;
&lt;br /&gt;
=== FastCGI ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_param QUERY_STRING $query_string;&lt;br /&gt;
fastcgi_param REQUEST_METHOD $request_method;&lt;br /&gt;
fastcgi_param CONTENT_TYPE $content_type;&lt;br /&gt;
fastcgi_param CONTENT_LENGTH $content_length;&lt;br /&gt;
&lt;br /&gt;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;&lt;br /&gt;
fastcgi_param REQUEST_URI $request_uri;&lt;br /&gt;
fastcgi_param DOCUMENT_URI $document_uri;&lt;br /&gt;
fastcgi_param DOCUMENT_ROOT $document_root;&lt;br /&gt;
fastcgi_param SERVER_PROTOCOL $server_protocol;&lt;br /&gt;
&lt;br /&gt;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;&lt;br /&gt;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;&lt;br /&gt;
&lt;br /&gt;
fastcgi_param REMOTE_ADDR $remote_addr;&lt;br /&gt;
fastcgi_param REMOTE_PORT $remote_port;&lt;br /&gt;
fastcgi_param SERVER_ADDR $server_addr;&lt;br /&gt;
fastcgi_param SERVER_PORT $server_port;&lt;br /&gt;
fastcgi_param SERVER_NAME $server_name;&lt;br /&gt;
&lt;br /&gt;
# PHP only, required if PHP was built with --enable-force-cgi-redirect&lt;br /&gt;
fastcgi_param REDIRECT_STATUS 200;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Slasharguments ===&lt;br /&gt;
&lt;br /&gt;
The slasharguments setting is intended mostly for diagnostic purposes and we strongly recommend this setting should be always &#039;&#039;&#039;enabled&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you disable this &#039;&#039;&#039;slasharguments&#039;&#039;&#039; setting, many Moodle features will not work properly, such as:&lt;br /&gt;
* SCORM packages.&lt;br /&gt;
* Relative links in embedded pages.&lt;br /&gt;
* Add-ons and plugins.&lt;br /&gt;
* Images.&lt;br /&gt;
&lt;br /&gt;
If you disable slasharguments setting and embedded images start to be displayed it means that the server is not properly configured.&lt;br /&gt;
&#039;&#039;&#039;Please note that will not be possible to disable slasharguments settings on moodle 3.0, we recommend to check and configure slasharguments in your webserver.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Some users are experiencing issues with relative links on Ngix web server as reported on the forum discussion:&lt;br /&gt;
[https://moodle.org/mod/forum/discuss.php?d=83445]&lt;br /&gt;
&lt;br /&gt;
Those issues can be easily fixed by adding the following configuration to the nginx.conf:&lt;br /&gt;
&#039;&#039;&#039;nginx.conf location:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
location ~ \.php(.*)$ {&lt;br /&gt;
include fastcgi_params;&lt;br /&gt;
fastcgi_index index.php;&lt;br /&gt;
if (!-e $request_filename) {&lt;br /&gt;
rewrite ^(.*\.php)(/)(.*)$ $1?file=/$3 last;&lt;br /&gt;
}&lt;br /&gt;
fastcgi_param SCRIPT_FILENAME /var/moodle_www/html$fastcgi_script_name;&lt;br /&gt;
fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
fastcgi_read_timeout 250s;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* https://docs.moodle.org/dev/Install_Moodle_On_Ubuntu_with_Nginx/PHP-fpm&lt;br /&gt;
* https://moodle.org/mod/forum/discuss.php?d=83445&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
[[es:Nginx]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Nginx&amp;diff=117702</id>
		<title>Nginx</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Nginx&amp;diff=117702"/>
		<updated>2015-03-26T09:06:13Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* Slasharguments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}[[Nginx]] [engine x] is an HTTP and reverse proxy server, as well as a mail proxy server, written by Igor Sysoev. The nginx project started with a strong focus on high concurrency, high performance and low memory usage. It is licensed under the 2-clause BSD-like license and it runs on Linux, BSD variants, Mac OS X, Solaris, AIX, HP-UX, as well as on other *nix flavors. It also has a proof of concept port for Microsoft Windows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The following is community-contributed documentation on Nginx configuration. Amendmends and additions are welcome.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Nginx configuration ==&lt;br /&gt;
&lt;br /&gt;
=== FastCGI ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_param QUERY_STRING $query_string;&lt;br /&gt;
fastcgi_param REQUEST_METHOD $request_method;&lt;br /&gt;
fastcgi_param CONTENT_TYPE $content_type;&lt;br /&gt;
fastcgi_param CONTENT_LENGTH $content_length;&lt;br /&gt;
&lt;br /&gt;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;&lt;br /&gt;
fastcgi_param REQUEST_URI $request_uri;&lt;br /&gt;
fastcgi_param DOCUMENT_URI $document_uri;&lt;br /&gt;
fastcgi_param DOCUMENT_ROOT $document_root;&lt;br /&gt;
fastcgi_param SERVER_PROTOCOL $server_protocol;&lt;br /&gt;
&lt;br /&gt;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;&lt;br /&gt;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;&lt;br /&gt;
&lt;br /&gt;
fastcgi_param REMOTE_ADDR $remote_addr;&lt;br /&gt;
fastcgi_param REMOTE_PORT $remote_port;&lt;br /&gt;
fastcgi_param SERVER_ADDR $server_addr;&lt;br /&gt;
fastcgi_param SERVER_PORT $server_port;&lt;br /&gt;
fastcgi_param SERVER_NAME $server_name;&lt;br /&gt;
&lt;br /&gt;
# PHP only, required if PHP was built with --enable-force-cgi-redirect&lt;br /&gt;
fastcgi_param REDIRECT_STATUS 200;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Slasharguments ===&lt;br /&gt;
&lt;br /&gt;
The slasharguments setting is intended mostly for diagnostic purposes and we strongly recommend this setting should be always &#039;&#039;&#039;enabled&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you disable this &#039;&#039;&#039;slasharguments&#039;&#039;&#039; setting, many Moodle features will not work properly, such as:&lt;br /&gt;
* SCORM packages.&lt;br /&gt;
* Relative links in embedded pages.&lt;br /&gt;
* Add-ons and plugins.&lt;br /&gt;
* Images.&lt;br /&gt;
&lt;br /&gt;
If you disable slasharguments setting and embedded images start to be displayed it means that the server is not properly configured.&lt;br /&gt;
&#039;&#039;&#039;Please note that will not be possible to disable slasharguments settings on moodle 3.0, we recommend to check and configure slasharguments in your webserver.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Some users are experiencing issues with relative links on Ngix web server as reported on the forum discussion:&lt;br /&gt;
[https://moodle.org/mod/forum/discuss.php?d=83445]&lt;br /&gt;
&lt;br /&gt;
Those issues can be easily fixed by adding the following configuration to the nginx.conf:&lt;br /&gt;
&#039;&#039;&#039;nginx.conf location:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
location ~ \.php(.*)$ {&lt;br /&gt;
include fastcgi_params;&lt;br /&gt;
fastcgi_index index.php;&lt;br /&gt;
if (!-e $request_filename) {&lt;br /&gt;
rewrite ^(.*\.php)(/)(.*)$ $1?file=/$3 last;&lt;br /&gt;
}&lt;br /&gt;
fastcgi_param SCRIPT_FILENAME /var/moodle_www/html$fastcgi_script_name;&lt;br /&gt;
fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
fastcgi_read_timeout 250s;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using Fast CGI use the following parameters:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fastcgi_param QUERY_STRING $query_string;&lt;br /&gt;
fastcgi_param REQUEST_METHOD $request_method;&lt;br /&gt;
fastcgi_param CONTENT_TYPE $content_type;&lt;br /&gt;
fastcgi_param CONTENT_LENGTH $content_length;&lt;br /&gt;
&lt;br /&gt;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;&lt;br /&gt;
fastcgi_param REQUEST_URI $request_uri;&lt;br /&gt;
fastcgi_param DOCUMENT_URI $document_uri;&lt;br /&gt;
fastcgi_param DOCUMENT_ROOT $document_root;&lt;br /&gt;
fastcgi_param SERVER_PROTOCOL $server_protocol;&lt;br /&gt;
&lt;br /&gt;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;&lt;br /&gt;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;&lt;br /&gt;
&lt;br /&gt;
fastcgi_param REMOTE_ADDR $remote_addr;&lt;br /&gt;
fastcgi_param REMOTE_PORT $remote_port;&lt;br /&gt;
fastcgi_param SERVER_ADDR $server_addr;&lt;br /&gt;
fastcgi_param SERVER_PORT $server_port;&lt;br /&gt;
fastcgi_param SERVER_NAME $server_name;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* https://docs.moodle.org/dev/Install_Moodle_On_Ubuntu_with_Nginx/PHP-fpm&lt;br /&gt;
* https://moodle.org/mod/forum/discuss.php?d=83445&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
[[es:Nginx]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Apache&amp;diff=117701</id>
		<title>Apache</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Apache&amp;diff=117701"/>
		<updated>2015-03-26T08:56:50Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* Slasharguments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
&#039;&#039;&#039;This article refers to the &#039;Apache HTTP server&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The Apache HTTP server is the software that (along with the PHP scripting language) &#039;runs&#039; Moodle. Note that there are alternatives (e.g. IIS on Windows) but the Apache HTTP Server is very popular on all platforms. &lt;br /&gt;
&lt;br /&gt;
== Installing Apache ==&lt;br /&gt;
Installers are available for most platforms from http://httpd.apache.org/download.cgi. The official installation instructions are here: http://httpd.apache.org/docs/2.0/install.html. If you are running Linux then you are recommended to use the packaged version if you can. For example in Debian/Ubuntu it is simply:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install apache2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the documentation for your particular platform for the instructions. Apache is straightforward to build from source if you have to and the PHP documentation contains an article on building both Apache and PHP together - although you should rarely need to do that.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
See [[Performance recommendations]]&lt;br /&gt;
&lt;br /&gt;
==Slasharguments==&lt;br /&gt;
&lt;br /&gt;
The slasharguments setting is intended mostly for diagnostic purposes and we strongly recommend this setting should be always &#039;&#039;&#039;enabled&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you disable this &#039;&#039;&#039;slasharguments&#039;&#039;&#039; setting, many Moodle features will not work properly, such as:&lt;br /&gt;
* SCORM packages.&lt;br /&gt;
* Relative links in embedded pages.&lt;br /&gt;
* Add-ons and plugins.&lt;br /&gt;
* Images.&lt;br /&gt;
&lt;br /&gt;
If you disable slasharguments setting and embedded images start to be displayed it means that the server is not properly configured.&lt;br /&gt;
&#039;&#039;&#039;Please note that will not be possible to disable slasharguments settings on moodle 3.0, we recommend to check and configure slasharguments in your webserver.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A common issue regarding SCORM packages reported on support forums:&lt;br /&gt;
* [[SCORM_FAQ#slash_arguments_warning_when_I_add.2Fupdate_SCORM_objects_in_my_course|SCORM FAQ: slash arguments warning when I add/update SCORM objects in my course]]&lt;br /&gt;
&lt;br /&gt;
A common problem on Apache web server is the &#039;&#039;&#039;File not found&#039;&#039;&#039; error after uploading a file. For further instructions to fix this issue can be found here:&lt;br /&gt;
* [[Installation_FAQ#Uploaded_files_give_.22File_not_found.22|File not found error on uploaded files]]&lt;br /&gt;
&lt;br /&gt;
If you are getting those errors, you need to enable slasharguments on your Apache web server. This can be easily configured by simply adding the following directive on httpd.conf or .htaccess :&lt;br /&gt;
&lt;br /&gt;
 AcceptPathInfo on&lt;br /&gt;
&lt;br /&gt;
==SSL==&lt;br /&gt;
&lt;br /&gt;
Moodle has an option to enable login pages to force the HTTPS protocol. This is recommended but requires that your web server is configured for SSL. It is possible to run the whole site over HTTPS (typically by configuring Apache to rewrite all http:// URLs to &amp;lt;nowiki&amp;gt;https://&amp;lt;/nowiki&amp;gt;) but as this disables caching, there is a considerable performance hit. Only do this if you have a very good reason.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WARNING: Before switching on login over HTTPS, make very sure that HTTPS is working (just change the http:// to https:// in any Moodle URL). If not, you may lock yourself out&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You have two options for obtaining an SSL certificate:&lt;br /&gt;
* generate a self-signed certificate. This is fine on (say) an Intranet but unsuitable for the public internet (except perhaps for testing). The user has no assurance that the certificate is legitimate. &lt;br /&gt;
* purchase a certificate from a vendor. There is a surprising range of prices and value-added services available. Some hosting companies even provide free certificates. &lt;br /&gt;
&lt;br /&gt;
Below are instructions for install of a self-signed certificate. If you purchase a certificate you will normally receive instructions for installing it&lt;br /&gt;
&lt;br /&gt;
===Debian and Apache2===&lt;br /&gt;
&lt;br /&gt;
1. generate a certification:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apache2-ssl-certificate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
for debian etch, apache2-ssl-certificate is no longer available, use make-ssl-cert instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
2. edit /etc/apache2/ports.conf:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      Listen 80&lt;br /&gt;
      Listen 443&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
3. copy /etc/apache)2/sites-available/default to /etc/apache2/sites-available/default-ssl, and change /etc/apache2/sites-available/default:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      NameVirtualHost *:80&lt;br /&gt;
      &amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
      ...&lt;br /&gt;
      &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and also /etc/apache2/sites-available/default-ssl:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      NameVirtualHost *:443&lt;br /&gt;
      &amp;lt;VirtualHost *:443&amp;gt;&lt;br /&gt;
      ...&lt;br /&gt;
              SSLEngine on&lt;br /&gt;
              SSLCertificateFile /etc/apache2/ssl/apache.pem&lt;br /&gt;
      ...&lt;br /&gt;
      &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
4. symbolic link the ssl file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a2ensite default-ssl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
5. don&#039;t forget to symbolic link the ssl module:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
a2enmod ssl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6. restart apache and &#039;&#039;&#039;test the connection&#039;&#039;&#039; (e.g. https://localhost/):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/etc/init.d/apache2 restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [http://httpd.apache.org/ The Apache HTTP Server Project homepage]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Apache_HTTP_Server Wikipedia article on the Apache HTTP Server]&lt;br /&gt;
* [http://httpd.apache.org/docs/2.0/misc/perf-tuning.html Apache Performance Tuning article at the official homepage]&lt;br /&gt;
* [https://els.earlham.edu/cayaraa/weblog/1468.html Making Moodle work with SSL]&lt;br /&gt;
* [http://www.krufix.de/ Using the same Moodle twice in local network and Internet via SSL-Proxy] (in German)&lt;br /&gt;
&lt;br /&gt;
[[pl:Apache]]&lt;br /&gt;
[[ja:Apache]]&lt;br /&gt;
[[de:Apache]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=SCORM_FAQ&amp;diff=117700</id>
		<title>SCORM FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=SCORM_FAQ&amp;diff=117700"/>
		<updated>2015-03-26T08:47:27Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* slash arguments warning when I add/update SCORM objects in my course */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{SCORM}}&lt;br /&gt;
==What is SCORM?==&lt;br /&gt;
&lt;br /&gt;
SCORM was developed as a result of collaboration in the public and private sectors. The President of the United States, Bill Clinton issued an Executive Order that created an agency (ADL) to oversee the standard for developing and distributing online learning.  All Federal agencies are mandated to use programs that meet those standards.  SCORM is one result of that order.  &lt;br /&gt;
&lt;br /&gt;
There&#039;s a really simple &amp;quot;What is SCORM&amp;quot; introduction here: http://moodle.org/mod/forum/discuss.php?d=3757#p18828&lt;br /&gt;
&lt;br /&gt;
A slightly more detailed introduction here: http://www.rusticisoftware.com/resources/whatisscorm/What%20Is%20SCORM.ht&lt;br /&gt;
&lt;br /&gt;
==Should I make my Moodle courses as SCORM or use Moodle&#039;s features?==&lt;br /&gt;
It depends how you intend to use it. If you are planning on exporting and using in another LMS then SCORM would make this easier. If you want something shiny, then a SCORM package can fit the bill. However, reporting and grading work better in Moodle and for many educators the standard features do the job perfectly and do not require learning a new program. There is a useful form post discussing the pros and cons of SCORM in Moodle here: http://moodle.org/mod/forum/discuss.php?d=200242&lt;br /&gt;
&lt;br /&gt;
==SCORM Information==&lt;br /&gt;
&lt;br /&gt;
Advanced Distributed Learning (ADL) is the organization that wrote the SCORM standard. You can download documentation and samples form ADL&#039;s Web site. Documentation for SCORM 1.2 in several languages is available  [http://www.adlnet.gov/Technologies/scorm/SCORMSDocuments/Forms/AllItems.aspx?RootFolder=%2fTechnologies%2fscorm%2fSCORMSDocuments%2fPrevious%20Versions%2fSCORM%201.2%2fDocumentation%20Suite%20(SCORM%201.2)&amp;amp;FolderCTID=0x0120007F801FCD5325044C89D91240519482D7&amp;amp;View={4D6DFFDE-3CFC-4DD9-A21A-4B687728824A} here].&lt;br /&gt;
&lt;br /&gt;
Philip Hutchison provides an AS3 and JavaScript wrapper, as well as a sample package: &lt;br /&gt;
http://pipwerks.com/downloads/&lt;br /&gt;
&lt;br /&gt;
==SCORM Package Contents==&lt;br /&gt;
&lt;br /&gt;
A SCORM package must contains in the root of zip a file named imsmanifest.xml which defines SCORM course structure, resource location and many other things. Other files used in the package, such as HTML files, XML files, multimedia files, and JavaScript for the SCORM API must be listed in this file. The LMS parses the manifest, and provides the files listed there to the content package during runtime.&lt;br /&gt;
&lt;br /&gt;
==AICC Package Contents==&lt;br /&gt;
&lt;br /&gt;
An AICC package is defined by several files (from 4 to 7) with defined extensions as follows:&lt;br /&gt;
&lt;br /&gt;
* CRS - Course Description file (mandatory)&lt;br /&gt;
* AU - Assignable Unit file (mandatory)&lt;br /&gt;
* DES - Descriptor file (mandatory)&lt;br /&gt;
* CST - Course Structure file (mandatory)&lt;br /&gt;
* ORE - Objective Relationship file (optional)&lt;br /&gt;
* PRE - Prerequisites file (optional)&lt;br /&gt;
* CMP - Completition Requirements file (optional)&lt;br /&gt;
&lt;br /&gt;
==Basic Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
* Make sure you are running Moodle 2.1 or higher, a large number of SCORM related bugs are present in previous versions.&lt;br /&gt;
*Make sure you (and your users) have JavaScript enabled. SCORM requires JavaScript.&lt;br /&gt;
* Make sure your SCORM object is SCORM compliant - check it in an external SCORM player like [https://docs.moodle.org/en/Tools_for_creating_SCORM_content#Reload Reload] to see if it works there.&lt;br /&gt;
* Upload a copy of your SCORM object to a [http://en.wikipedia.org/wiki/File_hosting_service File Hosting Service] and post a message asking for help in the forums, linking to your SCORM object explaining exactly what you expect to happen, and what is happening instead.&lt;br /&gt;
* Read Dan Marsden&#039;s blog post [http://danmarsden.com/blog/2012/08/08/scorm-doesnt-work-in-moodle here] (Maintainer of SCORM Module in Moodle)&lt;br /&gt;
&lt;br /&gt;
==Does Moodle Generate SCORM Content?==&lt;br /&gt;
&lt;br /&gt;
Moodle &#039;&#039;&#039;does not&#039;&#039;&#039; generate scorm content. Moodle presents the content in SCORM packages to learners, and saves data from learner interactions with the SCORM package.&lt;br /&gt;
&lt;br /&gt;
==Can I add a password for access to my SCORM package?==&lt;br /&gt;
No, although there is a tracker request for this: MDL-46403 As a workaround you could add your SCORM package using the single activity course format - see [[Course formats]] - and add an enrolment key to the course.&lt;br /&gt;
&lt;br /&gt;
==Supported Versions==&lt;br /&gt;
&lt;br /&gt;
* SCORM 1.2 is supported in Moodle 2.1(or higher) and passes all the tests in the ADL Conformance test suite 1.2.7 for SCORM 1.2. The best place for information on SCORM 1.2 conformance is the [http://www.adlnet.gov/Technologies/scorm/SCORMSDocuments/Previous%20Versions/SCORM%201.2/Conformance%20Test%20Suite%20(SCORM%201.2)/SCORM_1.2_ConformanceReq.pdf SCORM Comformance Requirements documentation (PDF 3.4MB)].&lt;br /&gt;
&lt;br /&gt;
* SCORM 2004 is not supported in Moodle. Parts of the API have been implemented, but others such as Navigation and Sequencing have not. Development on native SCORM 2004 support in Moodle [https://moodle.org/mod/forum/discuss.php?d=227906 has stopped]. If you require a fully certified SCORM 2004 Player in Moodle, [http://www.scorm.com Rustici Software] have a [http://support.scorm.com/entries/20394726-scorm-cloud-moodle-module Moodle plugin] which connects to their commercial [http://www.scorm.com/scorm-solved/scorm-cloud/ SCORM Cloud] service turning Moodle into a fully compliant SCORM 2004 LMS.&lt;br /&gt;
&lt;br /&gt;
* AICC objects are supported in Moodle 2.1 and higher.&lt;br /&gt;
&lt;br /&gt;
* Moodle does not support Tin Can at this stage.&lt;br /&gt;
&lt;br /&gt;
==Asking for Help in the SCORM Forum==&lt;br /&gt;
&lt;br /&gt;
When trying to engage the community to help with a problem you are facing, you will get a better response if you follow a few simple guidelines:&lt;br /&gt;
* Always start your report with &#039;&#039;&#039;version information&#039;&#039;&#039; - preferably the information displayed on the Admin -&amp;gt; Environment panel eg. http://localhost/moodle/admin/environment.php where http://localhost/moodle is your particular prefix.  With this it will be clear how you are running your Moodle instance, on what platform, and at which version.  This will quickly expose issues where a simple upgrade will solve your problem.&lt;br /&gt;
* Be prepared to &#039;&#039;&#039;provide the SCORM package&#039;&#039;&#039; that illustrates your problem - if you don&#039;t then it will be very difficult for anyone offering assistance to recreate your situation - a real barrier to help.&lt;br /&gt;
* &#039;&#039;&#039;Screenshots&#039;&#039;&#039; are very helpful. Provide a screenshot of all error messages, and any instance where something seems to go wrong in the interface.&lt;br /&gt;
* Nonstandard themes can introduce SCORM issues. Be sure to tell us &#039;&#039;&#039;what theme you&#039;re using&#039;&#039;&#039;.&lt;br /&gt;
* If you have admin privileges, and have access to a localhost install or other place where real-time users won&#039;t be disturbed, be sure to turn on debugging. Navigate to &#039;&#039;&#039;Site Administration &amp;gt; Development &amp;gt; Debugging&#039;&#039;&#039; and set &#039;&#039;&#039;Debug messages: Developer&#039;&#039;&#039; and &#039;&#039;&#039;Display debug messages: Yes&#039;&#039;&#039;. Access the SCORM content. If there are errors printed to the page, include them in your forum post. &lt;br /&gt;
* Use [https://developers.google.com/chrome-developer-tools/docs/console Chrome&#039;s JavaScript Console] or [https://developer.mozilla.org/en-US/docs/Tools/Web_Console Firebug&#039;s JavaScript console] to check that there are no JavaScript errors on the page when the content loads. &lt;br /&gt;
* Run your problematic SCORM package through &#039;&#039;&#039;API debugging&#039;&#039;&#039; (see below) and include the text of that API log with your post. That way we can see right away if the right function calls are not taking place.&lt;br /&gt;
* If you&#039;re using a content development suite which publishes to SCORM, such as Articulate, Captivate, Lectora, LessonBuilder, Udutu, or some other product, then include that in your post. Every authoring software has its ticks, and if you&#039;ve run into one, it&#039;s likely that someone else has also dealt with it, and will recognize it. However, please keep in mind that &#039;&#039;&#039;this is a place to get help with Moodle issues, not help with your SCORM package authoring suite&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Debugging ==&lt;br /&gt;
&lt;br /&gt;
# Debugging settings are located at Settings &amp;gt; Site Administration &amp;gt; Plugins &amp;gt; Activities &amp;gt; Scorm.&lt;br /&gt;
# Check the checkbox for &#039;&#039;&#039;Activate API debug...&#039;&#039;&#039;&lt;br /&gt;
# Set the api mask. You can use the mask to enable debugging under certain conditions. For example, if you are logged in using the admin user (username admin) you can set the api mask to: &amp;lt;cite&amp;gt;admin.*&amp;lt;/cite&amp;gt;  Users not logged in as admin will not see the debugging log. The &amp;quot;Default&amp;quot; api mask is &amp;lt;cite&amp;gt;.*&amp;lt;/cite&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==What does the debugging log mean?==&lt;br /&gt;
&lt;br /&gt;
The SCO commonly sends the following communications through the API:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;LMSInitialize();&#039;&#039;&#039; opens the connection between the SCO and Moodle&lt;br /&gt;
* &#039;&#039;&#039;LMSGetValue( &#039;valuename&#039; );&#039;&#039;&#039; gets a value from Moodle&lt;br /&gt;
* &#039;&#039;&#039;LMSSetValue( &#039;valuename&#039; , &#039;value&#039; );&#039;&#039;&#039; sends a value to Moodle&lt;br /&gt;
* &#039;&#039;&#039;LMSCommit();&#039;&#039;&#039; saves values sent to Moodle via LMSSetValue() and should be called after every LMSSetValue()&lt;br /&gt;
* &#039;&#039;&#039;LMSFinish()&#039;&#039;&#039; saves values sent to Moodle and closes the connection between the SCO And Moodle&lt;br /&gt;
&lt;br /&gt;
Red lines in the debugging log means there was an error in the communication through the API. &lt;br /&gt;
&lt;br /&gt;
If LMSInitialize() fails, returns an error, then no subsequent values sent to Moodle will be saved. &lt;br /&gt;
&lt;br /&gt;
Click through the entire SCORM package. Then access the scorm report for your attempt, and compare the saved values in the debugging log with Moodle&#039;s report of the attempt. If the values set in the debug log do not match the values saved to Moodle, then there may be a problem with Moodle. Otherwise it&#039;s likely to be an issue with the SCO or the SCORM activity settings not giving you the functionality you need.&lt;br /&gt;
&lt;br /&gt;
==SCORM and the Gradebook==&lt;br /&gt;
Please see [https://docs.moodle.org/en/SCORM_FAQ#My_SCORM_Module_doesn.27t_function_properly FAQ:My SCORM Module doesn&#039;t function properly] and  [https://docs.moodle.org/en/SCORM_FAQ#Handling_of_Multiple_Attempts FAQ:Handling of Multiple Attempts]&lt;br /&gt;
&lt;br /&gt;
Some SCORM packages report both cmi.core.lesson_status and cmi.core.score.raw. Others report only cmi.core.lesson_status, or only cmi.core.score.raw. The &#039;&#039;&#039;Grading Method&#039;&#039;&#039; setting for SCORM objects is meant to account for that.  &lt;br /&gt;
&lt;br /&gt;
If you have the &#039;&#039;&#039;Grading Method&#039;&#039;&#039; set to &#039;&#039;&#039;Highest grade&#039;&#039;&#039;, &#039;&#039;&#039;Average grade&#039;&#039;&#039;, or &#039;&#039;&#039;Sum grade&#039;&#039;&#039;, and your learning object does not report a score, only, cmi.core.lesson_status, then there will be no numerical score to pass to the gradebook. &lt;br /&gt;
&lt;br /&gt;
If your SCOs do not report cmi.core.score.raw, then the best &#039;&#039;&#039;Grading Method&#039;&#039;&#039; setting is &#039;&#039;&#039;Learning Objects&#039;&#039;&#039;. This reports either a 1 or a 0 as a score for each learning object. The gradebook value for that SCORM activity is the percent of scos in the package for which learners got a 1. &lt;br /&gt;
&lt;br /&gt;
On the other hand, if your SCOs do not report a lesson_status, then select one of the score-based &#039;&#039;&#039;Grading Method&#039;&#039;&#039; options, such as &#039;&#039;&#039;Highest grade&#039;&#039;&#039;, &#039;&#039;&#039;Average grade&#039;&#039;&#039;, or &#039;&#039;&#039;Sum grade&#039;&#039;&#039;, and not &#039;&#039;&#039;Learning Objects&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you do not know what your SCOs are reporting to the LMS, then run them through to completion with debugging on.&lt;br /&gt;
&lt;br /&gt;
Much of the way SCORM objects are graded is controlled inside the SCORM Authoring process before it is packaged for use in an LMS like Moodle - make sure all your grading settings are set correctly.&lt;br /&gt;
&lt;br /&gt;
==SCORM Administration Options==&lt;br /&gt;
&lt;br /&gt;
See [[SCORM settings]]&lt;br /&gt;
&lt;br /&gt;
==Common Solutions==&lt;br /&gt;
&lt;br /&gt;
===Difficulty Displaying a SCORM Package===&lt;br /&gt;
If you have difficulty displaying a SCORM, try loading the SCORM in [http://www.reload.ac.uk Reload] and re-saving it, then save the folder as a .zip package and try again.&lt;br /&gt;
&lt;br /&gt;
===Character Display Errors===&lt;br /&gt;
When you notice there is a problem displaying characters correctly, it could be a misconfiguration of your server. Make sure that both httpd.conf (when using Apache) and php.ini are set to DefaultCharacterset = utf8 or switch the sending of a default character set off.&lt;br /&gt;
&lt;br /&gt;
===slash arguments warning when I add/update SCORM objects in my course===&lt;br /&gt;
SCORM require &#039;&#039;&#039;slasharguments&#039;&#039;&#039; on the web server in order to work properly. Unfortunately, some PHP servers doesn&#039;t allow this method and your SCORM objects might not displayed. &lt;br /&gt;
&lt;br /&gt;
This affects IIS 5 and earlier and some Apache servers. Under IIS 5 and earlier, a workaround using an [http://www.isapirewrite.com/ ISAPI re-write] tool can be used. &lt;br /&gt;
&lt;br /&gt;
A common problem on Apache web server is the &#039;&#039;&#039;File not found&#039;&#039;&#039; error after uploading a file. For further instructions to fix this issue can be found here:&lt;br /&gt;
* [[Installation_FAQ#Uploaded_files_give_.22File_not_found.22|File not found error on uploaded files]]&lt;br /&gt;
&lt;br /&gt;
For further information about slasharguments and web server configuration see:&lt;br /&gt;
* [[admin/environment/slasharguments|Slasharguments]] &lt;br /&gt;
* [[Internet Information Services#Slasharguments|IIS server configuration]]&lt;br /&gt;
* [[Internet Information Services#Slasharguments|IIS server configuration]]&lt;br /&gt;
* [[Apache#Slasharguments|Apache slasharguments configuration]]&lt;br /&gt;
* [[Nginx#Slasharguments|Nginx slasharguments configuration]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note that will not be possible to disable slasharguments settings on moodle 3.0, we recommend to check and configure slasharguments in your webserver.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===SCORM doesn&#039;t work on Godaddy Host===&lt;br /&gt;
Godaddy hosts give a 404 file not found error - this is because by default they do not allow slash arguments which SCORM requires. The best way to test this is to visit http://yourmoodlesite/admin/tool/health/index.php - but the fix involves adding a php.ini or php5.ini file with the following text:&lt;br /&gt;
 AcceptPathInfo&lt;br /&gt;
 cgi.fix_pathinfo=1&lt;br /&gt;
&lt;br /&gt;
===My Flash-Based Content Loads, then Stalls===&lt;br /&gt;
This issue is most commonly associated with zlib compression. Classic presentation is that the base HTML file and SWF are loaded into the SCORM player, but the SWF is not able to load any audio or video assets, and therefore stalls. You can watch the loading of SWFs and assets using Chrome&#039;s Developer Tools or other. &lt;br /&gt;
&lt;br /&gt;
Check your site&#039;s zlib compression settings as an admin by loading up the Server &amp;gt; phpinfo page. zlib compression is not a Moodle setting but a server setting, so you&#039;ll need a server admin to disable it. Be sure to Purge All Caches, and clear browser caches, before confirming the change. &lt;br /&gt;
&lt;br /&gt;
===Zlib warning when I add/update SCORM objects in my course===&lt;br /&gt;
Zlib is a php compression setting made in a websites PHP configuration - unfortunately some browsers don&#039;t handle this well (especially Internet Explorer 6) Some webhosts enable this setting, but it will likely cause issues for your users when they attempt to view/use the SCORM object. You will need to contact your server administrator to turn this off. The setting to change in php configuration is &amp;quot;zlib.output_compression&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Incorrect file package - missing imsmanifest.xml or AICC structure===&lt;br /&gt;
This means that Moodle cannot find a file called imsmanifest.xml inside the SCORM object. Reasons for this could be:&lt;br /&gt;
* imsmanifest.xml needs to be immediately inside the scorm directory, NOT inside a directory inside of that. So if the zipped scorm package is package.zip, the unzipped package directory should contain immediately inside of it the imsmanifest.xml. This is a common mistake and normally occurs when a SCORM author creates a package themselves and then selects that folder to compress. This places the content folder inside of another folder, The imsmanifest.xml is there, but it is 2 directories deep. To avoid this problem when zipping scorm content into a package, go INSIDE of the exported scorm folder, select all files inside, and compress them while all are selected. The resultant compressed directory has the imsmanifest.xml file in the first directory, immediately available to the moodle scorm loading process. &lt;br /&gt;
* when using linux based systems the filename imsmanifest.xml must be all in lowercase not IMSmanifest.xml or Imsmanifest.XML&lt;br /&gt;
* The SCORM authoring tool Articulate sometimes fails to create the imsmanifest.xml -Try exporting the package again and see if the manifest is generated.&lt;br /&gt;
* The SCORM authoring tool Articulate Presenter will publish packages where the imsmanifest.xml file is in the correct place, but there are several lines of white space in the manifest file if you do not fill out the Reporting and Tracking Options in Articulate Presenter for Keywords and LMS Description. Moodle will give a &amp;quot;Manifest not found&amp;quot; error when encountering this. To fix this problem select the Reporting and Tracking Options in the Articulate Presenter publish dialog and fill in the LMS Description and Keywords.&lt;br /&gt;
&lt;br /&gt;
===File not found error===&lt;br /&gt;
You have this error if the scorm package is created in moodle, and the scorm menu loads, but inside of the viewing area for the scorm content, you get a page with a 404 file not found error, usually showing the current Moodle theme. &lt;br /&gt;
&lt;br /&gt;
What this means is that one of the files listed in the imsmanifest.xml is not in the scorm package or not in the correct directory.&lt;br /&gt;
&lt;br /&gt;
Download and unzip the package, open up imsmanifest.xml. At the bottom of the xml file, below any metadata, you&#039;ll find a place where organizations and resources for those organizations are designated: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code xml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;organizations default=&amp;quot;TOC1&amp;quot;&amp;gt; &lt;br /&gt;
         &amp;lt;organization identifier=&amp;quot;TOC1&amp;quot;&amp;gt; &lt;br /&gt;
            &amp;lt;title&amp;gt;SCORM Test&amp;lt;/title&amp;gt;&lt;br /&gt;
            &amp;lt;item identifier=&amp;quot;I_SCO0&amp;quot; identifierref=&amp;quot;SCO0&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;title&amp;gt;Library Quiz&amp;lt;/title&amp;gt;&lt;br /&gt;
            &amp;lt;adlcp:masteryscore&amp;gt;0&amp;lt;/adlcp:masteryscore&amp;gt;&lt;br /&gt;
         &amp;lt;/item&amp;gt;&lt;br /&gt;
         &amp;lt;/organization&amp;gt;&lt;br /&gt;
      &amp;lt;/organizations&amp;gt;&lt;br /&gt;
      &amp;lt;resources&amp;gt;&lt;br /&gt;
         &amp;lt;resource identifier=&amp;quot;SCO0&amp;quot; type=&amp;quot;webcontent&amp;quot; adlcp:scormtype=&amp;quot;sco&amp;quot; href=&amp;quot;scorm.html&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;file href=&amp;quot;scorm.html&amp;quot;/&amp;gt;&lt;br /&gt;
            &amp;lt;dependency identifierref=&amp;quot;ALLRESOURCES&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;/resource&amp;gt; &lt;br /&gt;
         &amp;lt;resource identifier=&amp;quot;ALLRESOURCES&amp;quot; type=&amp;quot;webcontent&amp;quot; adlcp:scormtype=&amp;quot;asset&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;file href=&amp;quot;scorm.html&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;file href=&amp;quot;scorm.js&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;file href=&amp;quot;swfobject.js&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;file href=&amp;quot;scorm.swf&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;file href=&amp;quot;scormwrapper.js&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;/resource&amp;gt;&lt;br /&gt;
      &amp;lt;/resources&amp;gt;&lt;br /&gt;
   &amp;lt;/manifest&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this xml, we have a single organization, and in that organization is a single resource, a single sco. There are 5 files necessary for that resource to work correctly. The scorm.html file is loaded first. It loads 3 external js files and a swf. &lt;br /&gt;
&lt;br /&gt;
What you need to do now is go to the directory containing imsmanifest.xml, and check that all of those listed files are available at the correct path from imsmanfiest.xml, as listed in imsmanifest.xml. If any one of those files is missing (especially the html file or the swf), or if the paths in imsmanifest.xml are incorrect, then it&#039;s very likely that the scorm object won&#039;t be able to load at all. &lt;br /&gt;
&lt;br /&gt;
Sometimes the files aren&#039;t missing, but are simply misnamed in the manifest, or placed in the wrong directory. You can fix this by moving the files to the correct places, or updating their names so that the imsmanifest and the actual file names match up. In the case of a misnamed file, change the manifest rather than the actual file names, since the the files also reference one another in other places!&lt;br /&gt;
&lt;br /&gt;
===Unzip issues===&lt;br /&gt;
If you get a blank page after filling in the title, description, and selecting a large SCORM file, it&#039;s likely you haven&#039;t installed the PHP-zip lib which is required for Moodle 2.x for more info see [[admin/environment/php_extension/zip]]&lt;br /&gt;
&lt;br /&gt;
===Clear an Attempt===&lt;br /&gt;
To clear attempts by a student:&lt;br /&gt;
&lt;br /&gt;
# Go to the SCORM activity and select the link &amp;quot;View reports for x users&amp;quot;&lt;br /&gt;
# Select the attempt or attempts you want to clear using the checkbox&lt;br /&gt;
# Select Delete in the drop-down box at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
===Handling of Multiple Attempts===&lt;br /&gt;
SCORM is designed to allow a learner to exit and return at a later date to the same point they left from. This means that each time they enter the SCORM they are using the same single attempt. Some SCORM packages are intelligent about handling re-entry, many are not. What this means is that if the learner re-enters an existing attempt, if the SCORM content does not have internal logic to avoid overwriting cmi.core.lesson_status and cmi.core.score.raw, they can be overwritten by a lower score, confusing the learner.&lt;br /&gt;
&lt;br /&gt;
When a SCORM sets the cmi.core.lesson_status value to &#039;completed&#039;, &#039;passed&#039; or &#039;failed&#039; then Moodle allows the user to create a new attempt by adding a &#039;&#039;&#039;Start new attempt&#039;&#039;&#039; checkbox to the entry page. If cmi.core.lesson_status is set to &#039;incomplete&#039;, &#039;browsed&#039; or &#039;notattempted&#039; the learner can only re-enter the existing attempt. If you are using the setting &#039;Student skip content structure page&#039;, this checkbox will never be shown to the user.&lt;br /&gt;
&lt;br /&gt;
Moodle provides a range of settings to allow this to be controlled, some of these settings are hidden by default as advanced options.&lt;br /&gt;
* Number of attempts&lt;br /&gt;
:This allows the teacher to set how many SCORM attempts the learner may create - this is not how many times a learner can re-enter a SCORM attempt.&lt;br /&gt;
* Attempts grading&lt;br /&gt;
:This allows the teacher to set how multiple SCORM attempts(not re-entries) are graded. It is important to note that a &#039;failed&#039; cmi.core_lesson_status allows a new attempt to be generated but the attempts grading setting &amp;quot;last completed attempt&amp;quot; only includes &#039;completed&#039; and &#039;passed&#039; values in it&#039;s calculations.&lt;br /&gt;
* Display attempt status&lt;br /&gt;
:This displays a users SCORM attempts and how their final grade is calculated on the SCORM entry page and the My Moodle page for the learner.&lt;br /&gt;
* Force completed&lt;br /&gt;
:This is a setting that can be used to force a SCORM package to report a &#039;completed&#039; cmi.core.lesson_status if it doesn&#039;t currently set the value.&lt;br /&gt;
* Force new attempt&lt;br /&gt;
:This hides the &#039;&#039;&#039;Start new attempt&#039;&#039;&#039; checkbox and will force a new attempt if the previous attempt has cmi.core.lesson_status value to &#039;completed&#039;, &#039;passed&#039; or &#039;failed&#039; - this setting can also be used to make sure a new attempt is generated when the &#039;Student skip content structure page&#039; setting is used.&lt;br /&gt;
* Lock after final attempt&lt;br /&gt;
:This prevents access to the SCORM after the total number of attempts have been used - if this is not set the learner can re-enter their last attempt and potentially change/overwrite their score each time depending on how the SCORM package supports multiple re-entries.&lt;br /&gt;
&lt;br /&gt;
===Reducing Load Time with Captivate===&lt;br /&gt;
* Modify the percent that must be downloaded before the content starts to play. In Captivate 4, there&#039;s a setting in: Preferences / Project / Start and End / Preload. Reduce that to 50%.&lt;br /&gt;
* If you use audio in your Cp file (as background or element attachment), try to put a gap of 0,1 second at the beginning of each element including audio on your slides. If you don&#039;t do that, Cp merge all the audio files in one big audio file it need to download before playing the project. This problem have been report many times from the Cp community.&lt;br /&gt;
&lt;br /&gt;
===Moodle changes cmi.core.lesson_status from &amp;quot;completed&amp;quot; or &amp;quot;passed&amp;quot; to &amp;quot;failed&amp;quot;===&lt;br /&gt;
Many SCORM authorware suites generate a masteryscore node in the imsmanifest.xml by default. This node is not necessary to the XML file. But when it is there, the SCORM standard designates specific behavior with regard to the value set there. &lt;br /&gt;
&lt;br /&gt;
Here&#039;s what is in the scorm standard, on page 35 of 155 in SCORM_1.2_ConformanceReq.pdf, numbered page 2-19 ([http://www.adlnet.gov/Technologies/scorm/SCORMSDocuments/Forms/AllItems.aspx?RootFolder=%2fTechnologies%2fscorm%2fSCORMSDocuments%2fPrevious%20Versions%2fSCORM%201%2e2%2fDocumentation%20Suite%20%28SCORM%201%2e2%29&amp;amp;FolderCTID=0x0120007F801FCD5325044C89D91240519482D7&amp;amp;View=%7b4D6DFFDE%2d3CFC%2d4DD9%2dA21A%2d4B687728824A%7d SCORM Version 1.2 Conformance Requirements Version 1.2]):&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
If the value for this element is not set to “incomplete” by the SCO, then the LMS shall re-evaluate and change the value based on the following:&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If there is no mastery score in the Manifest, and the SCO sets a score (cmi.core.score.raw) and the lesson_status (cmi.core.lesson_status) then the LMS shall not override the SCO determined status.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If there is a mastery score in the Manifest, the LMS can change the status to either passed or failed depending on the student&#039;s score (cmi.core.score.raw) compared to the mastery score.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If the student is taking the SCO for no-credit, (cmi.core.credit = “no-credit”) there is no change to the lesson_status, with one exception. If the lesson_mode (cmi.core.lesson_mode) is &amp;quot;browse&amp;quot;, the lesson_status may change to &amp;quot;browsed&amp;quot; even if the cmi.core.credit is set to no-credit.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This can result in some functionality you don&#039;t intend. You can fix the problem by removing the mastery score node from your imsmanifest.xml file. You will also want to find out what options you have, within your authorware suite, for the writing of that node into the manifest file, and change your authoring process accordingly.&lt;br /&gt;
&lt;br /&gt;
===Player Look &#039;n Feel===&lt;br /&gt;
You should be able to adjust height and width settings for the SCORM player window &#039;&#039;&#039;so long as&#039;&#039;&#039; your theme is based on/not too much of an aberration from one of the standard themes which ship with Moodle 2. &lt;br /&gt;
&lt;br /&gt;
If your site or course theme isn&#039;t closely based on one of the standard M2 themes, then it&#039;s possible that your theme CSS is overriding local height and width settings for the SCORM player. Have a Web developer (or a Moodle Partner) examine how your theme is interacting with the player layout, and make changes to your theme as needed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Why can&#039;t I just change it locally?&#039;&#039;&#039; You can change height and width per individual SCORM package, and you can set defaults for these local height and width values ( [[SCORM Admin Options]] ). Other things, such as colors, shading, borders, backgrounds, are controlled by CSS, just like everything else on the site.&lt;br /&gt;
&lt;br /&gt;
=== Courselab 2.4 ===&lt;br /&gt;
If you receive a &amp;quot; found more than one record!&amp;quot; error when trying to run your SCORM 1.2 package check the imsmanifest.xml file of your SCORM package and ensure that the values for &amp;lt;organization identifier&amp;gt; and &amp;lt;item identifier&amp;gt; are unique. To change the &amp;lt;organization identifier&amp;gt;, in Courselab, go to File &amp;gt; Course Runtime Settings. The dialog says &#039;Course identification in LMS&#039; but changing the Identifier field is what sets the &amp;lt;organization identifier&amp;gt;.  (see MDL-38060 for more information)&lt;br /&gt;
&lt;br /&gt;
=== SCORM results deleted after package update ===&lt;br /&gt;
&lt;br /&gt;
When uploading a SCORM package over a previous one, if the item identifier in the manifest file is different to the one being overwritten then the tracking data for that SCORM package in Moodle is deleted.&lt;br /&gt;
&lt;br /&gt;
Ensure the item identifier is the same for the new SCORM resource&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?id=1951 SCORM forum]&lt;br /&gt;
* [http://danmarsden.com/blog/2012/08/08/scorm-doesnt-work-in-moodle SCORM doesn&#039;t work] blog post from developer Dan Marsden&lt;br /&gt;
* [http://danmarsden.com/blog/2009/05/23/scorm-2004-in-moodle/ SCORM 2004 in Moodle] blog post from developer Dan Marsden&lt;br /&gt;
* [https://docs.moodle.org/dev/SCORM_schema Internal SCORM Schema]&lt;br /&gt;
* The official standard: [http://www.adlnet.gov/Technologies/scorm/default.aspx Advanced Distributed Learning - SCORM]&lt;br /&gt;
&lt;br /&gt;
Online resources&lt;br /&gt;
* [http://www.scormcourse.com/ SCORMCourse.com] serves the SCORM and ADL community as an educational resource for SCORM technology.&lt;br /&gt;
* [http://www.eduworks.com/index.php/Publications/Learning-Object-Tutorial.html Learning Object Tutorial]&lt;br /&gt;
* [http://elearningweekly.wordpress.com/2007/04/12/tutorial-build-scorm-compatible-lesson-templates-for-your-lms/ Tutorial: Build SCORM-Compatible Lesson Templates for Your LMS]&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=3757 Simple introduction to SCORM] &lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=57059 Are there any sugestions for scorm authoring with Microsoft word / or any other easy (maybe free) scorm authoring tool?]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=95946 Is SCORM worth it?]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=207964 Updating an Object]&lt;br /&gt;
 &lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
[[de:Lernpaket FAQ]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Using_slash_arguments&amp;diff=117699</id>
		<title>Using slash arguments</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Using_slash_arguments&amp;diff=117699"/>
		<updated>2015-03-26T08:45:00Z</updated>

		<summary type="html">&lt;p&gt;Lameze: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Environment}}&lt;br /&gt;
&lt;br /&gt;
The slasharguments setting is intended mostly for diagnostic purposes and we strongly recommend this setting should be always &#039;&#039;&#039;enabled&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you disable this &#039;&#039;&#039;slasharguments&#039;&#039;&#039; setting, many Moodle features will not work properly, such as:&lt;br /&gt;
* SCORM packages.&lt;br /&gt;
* Relative links in embedded pages.&lt;br /&gt;
* Add-ons and plugins.&lt;br /&gt;
* Images.&lt;br /&gt;
&lt;br /&gt;
If you disable slasharguments setting and embedded images start to be displayed it means that the server is not properly configured.&lt;br /&gt;
&lt;br /&gt;
Another very common problem reported on support forums about slasharguments:&lt;br /&gt;
* [[SCORM_FAQ#slash_arguments_warning_when_I_add.2Fupdate_SCORM_objects_in_my_course|SCORM FAQ: slash arguments warning when I add/update SCORM objects in my course]]&lt;br /&gt;
&lt;br /&gt;
A common problem on Apache web server is the &#039;&#039;&#039;File not found&#039;&#039;&#039; error after uploading a file. For further instructions to fix this issue can be found here:&lt;br /&gt;
* [[Installation_FAQ#Uploaded_files_give_.22File_not_found.22|File not found error on uploaded files]]&lt;br /&gt;
&lt;br /&gt;
For further information about slasharguments configuration on web servers see: &lt;br /&gt;
* [[Internet Information Services#Slasharguments|IIS server configuration]]&lt;br /&gt;
* [[Apache#Slasharguments|Apache slasharguments configuration]]&lt;br /&gt;
* [[Nginx#Slasharguments|Nginx slasharguments configuration]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note that will not be possible to disable slasharguments settings on moodle 3.0, we recommend to check and configure slasharguments in your webserver.&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Using_slash_arguments&amp;diff=117698</id>
		<title>Using slash arguments</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Using_slash_arguments&amp;diff=117698"/>
		<updated>2015-03-26T08:44:26Z</updated>

		<summary type="html">&lt;p&gt;Lameze: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Environment}}&lt;br /&gt;
&lt;br /&gt;
The slasharguments setting is intended mostly for diagnostic purposes and we &#039;&#039;&#039;&#039;&#039;&#039;strongly recommend this setting should be always enabled&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
If you disable this &#039;&#039;&#039;slasharguments&#039;&#039;&#039; setting, many Moodle features will not work properly, such as:&lt;br /&gt;
* SCORM packages.&lt;br /&gt;
* Relative links in embedded pages.&lt;br /&gt;
* Add-ons and plugins.&lt;br /&gt;
* Images.&lt;br /&gt;
&lt;br /&gt;
If you disable slasharguments setting and embedded images start to be displayed it means that the server is not properly configured.&lt;br /&gt;
&lt;br /&gt;
Another very common problem reported on support forums about slasharguments:&lt;br /&gt;
* [[SCORM_FAQ#slash_arguments_warning_when_I_add.2Fupdate_SCORM_objects_in_my_course|SCORM FAQ: slash arguments warning when I add/update SCORM objects in my course]]&lt;br /&gt;
&lt;br /&gt;
A common problem on Apache web server is the &#039;&#039;&#039;File not found&#039;&#039;&#039; error after uploading a file. For further instructions to fix this issue can be found here:&lt;br /&gt;
* [[Installation_FAQ#Uploaded_files_give_.22File_not_found.22|File not found error on uploaded files]]&lt;br /&gt;
&lt;br /&gt;
For further information about slasharguments configuration on web servers see: &lt;br /&gt;
* [[Internet Information Services#Slasharguments|IIS server configuration]]&lt;br /&gt;
* [[Apache#Slasharguments|Apache slasharguments configuration]]&lt;br /&gt;
* [[Nginx#Slasharguments|Nginx slasharguments configuration]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note that will not be possible to disable slasharguments settings on moodle 3.0, we recommend to check and configure slasharguments in your webserver.&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Using_slash_arguments&amp;diff=117697</id>
		<title>Using slash arguments</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Using_slash_arguments&amp;diff=117697"/>
		<updated>2015-03-26T08:43:27Z</updated>

		<summary type="html">&lt;p&gt;Lameze: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Environment}}&lt;br /&gt;
&lt;br /&gt;
The slasharguments setting is intended mostly for diagnostic purposes and we strongly recommend this setting should be always enabled.&lt;br /&gt;
If you disable this slasharguments setting, many Moodle features will not work properly, such as:&lt;br /&gt;
* SCORM packages.&lt;br /&gt;
* Relative links in embedded pages.&lt;br /&gt;
* Add-ons and plugins.&lt;br /&gt;
* Images.&lt;br /&gt;
&lt;br /&gt;
If you disable slasharguments setting and embedded images start to be displayed it means that the server is not properly configured.&lt;br /&gt;
&lt;br /&gt;
Another very common problem reported on support forums about slasharguments:&lt;br /&gt;
* [[SCORM_FAQ#slash_arguments_warning_when_I_add.2Fupdate_SCORM_objects_in_my_course|SCORM FAQ: slash arguments warning when I add/update SCORM objects in my course]]&lt;br /&gt;
&lt;br /&gt;
A common problem on Apache web server is the &#039;&#039;&#039;File not found&#039;&#039;&#039; error after uploading a file. For further instructions to fix this issue can be found here:&lt;br /&gt;
* [[Installation_FAQ#Uploaded_files_give_.22File_not_found.22|File not found error on uploaded files]]&lt;br /&gt;
&lt;br /&gt;
For further information about slasharguments configuration on web servers see: &lt;br /&gt;
* [[Internet Information Services#Slasharguments|IIS server configuration]]&lt;br /&gt;
* [[Apache#Slasharguments|Apache slasharguments configuration]]&lt;br /&gt;
* [[Nginx#Slasharguments|Nginx slasharguments configuration]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note that will not be possible to disable slasharguments settings on moodle 3.0, we recommend to check and configure slasharguments in your webserver.&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Using_slash_arguments&amp;diff=117696</id>
		<title>Using slash arguments</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Using_slash_arguments&amp;diff=117696"/>
		<updated>2015-03-26T08:24:12Z</updated>

		<summary type="html">&lt;p&gt;Lameze: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Environment}}&lt;br /&gt;
&lt;br /&gt;
The slasharguments setting is intended mostly for diagnostic purposes and we strongly recommend this setting should be always enabled.&lt;br /&gt;
If you disable this slasharguments setting, many Moodle features will not work properly, such as:&lt;br /&gt;
* SCORM packages.&lt;br /&gt;
* Relative links in embedded pages.&lt;br /&gt;
* Add-ons and plugins.&lt;br /&gt;
* Images.&lt;br /&gt;
&lt;br /&gt;
If you disable slasharguments setting and embedded images start to be displayed it means that the server is not properly configured.&lt;br /&gt;
Another very common problem reported on support forums about slasharguments:&lt;br /&gt;
* [[SCORM_FAQ#slash_arguments_warning_when_I_add.2Fupdate_SCORM_objects_in_my_course|SCORM FAQ: slash arguments warning when I add/update SCORM objects in my course]]&lt;br /&gt;
&lt;br /&gt;
For further information about slasharguments configuration on web servers see: &lt;br /&gt;
* [[Internet Information Services#Slasharguments|IIS server configuration]]&lt;br /&gt;
* [[Apache#Slasharguments|Apache slasharguments configuration]]&lt;br /&gt;
* [[Nginx#Slasharguments|Nginx slasharguments configuration]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note that will not be possible to disable slasharguments settings on moodle 3.0, we recommend to check and configure slasharguments in your webserver.&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Using_slash_arguments&amp;diff=117695</id>
		<title>Using slash arguments</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Using_slash_arguments&amp;diff=117695"/>
		<updated>2015-03-26T08:23:28Z</updated>

		<summary type="html">&lt;p&gt;Lameze: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Environment}}&lt;br /&gt;
&lt;br /&gt;
The slasharguments setting is intended mostly for diagnostic purposes and we strongly recommend this setting should be always enabled.&lt;br /&gt;
If you disable this slasharguments setting, many Moodle features will not work properly, such as:&lt;br /&gt;
* SCORM packages.&lt;br /&gt;
* Relative links in embedded pages.&lt;br /&gt;
* Add-ons and plugins.&lt;br /&gt;
* Broken images.&lt;br /&gt;
&lt;br /&gt;
If you disable slasharguments setting and embedded images start to be displayed it means that the server is not properly configured.&lt;br /&gt;
Another very common problem reported on support forums about slasharguments:&lt;br /&gt;
* [[SCORM_FAQ#slash_arguments_warning_when_I_add.2Fupdate_SCORM_objects_in_my_course|SCORM FAQ: slash arguments warning when I add/update SCORM objects in my course]]&lt;br /&gt;
&lt;br /&gt;
For further information about slasharguments configuration on web servers see: &lt;br /&gt;
* [[Internet Information Services#Slasharguments|IIS server configuration]]&lt;br /&gt;
* [[Apache#Slasharguments|Apache slasharguments configuration]]&lt;br /&gt;
* [[Nginx#Slasharguments|Nginx slasharguments configuration]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note that will not be possible to disable slasharguments settings on moodle 3.0, we recommend to check and configure slasharguments in your webserver.&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Grade_import&amp;diff=117347</id>
		<title>Grade import</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Grade_import&amp;diff=117347"/>
		<updated>2015-03-05T03:07:48Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* CSV import */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Grades}}&lt;br /&gt;
==Importing grades==&lt;br /&gt;
Grades may be imported as a CSV or XML file, or (new in 2.8 onwards) by pasting from a spreadsheet.&lt;br /&gt;
&lt;br /&gt;
The import file format is the same as the corresponding export format. &lt;br /&gt;
&lt;br /&gt;
Note: Grade import is equivalent to manual grading in the [[Grader report|grader report]]. Thus, if grades for a particular  Moodle activity such as an assignment are imported, they can no longer be edited via the assignment submission page.&lt;br /&gt;
&lt;br /&gt;
[[Image:Csv grade import.png|thumb|CSV grade import]]&lt;br /&gt;
To import grades into the gradebook:&lt;br /&gt;
&lt;br /&gt;
# Decide on an import format - CSV or XML file, or paste from spreadsheet (see below) - then [[Grade export|export some grades]] using the corresponding export format.&lt;br /&gt;
# Edit the export file as appropriate and save it.&lt;br /&gt;
# Tip:  If you opened your exported file in Excel, don&#039;t add columns there because Moodle will reject the import if there are new columns that didn&#039;t exist in the exported file. If you need to add columns, do that in Moodle BEFORE you export your gradebook.&lt;br /&gt;
# Select your chosen import format from the gradebook dropdown menu.&lt;br /&gt;
# Browse and upload your previously saved file.&lt;br /&gt;
# Set options as required.&lt;br /&gt;
# Click the &amp;quot;Upload grades&amp;quot; button.&lt;br /&gt;
# CSV import only: Preview the grade import and choose the column mapping then click the &amp;quot;Upload grades&amp;quot; button to complete the grade import.&lt;br /&gt;
## Tip: By default &amp;quot;Map from&amp;quot; is set to First Name, and &amp;quot;Map to&amp;quot; to userid. Change both dropdowns to: &amp;quot;Email Address&amp;quot; to &amp;quot;useremail&amp;quot;, or to &amp;quot;Id Number&amp;quot; to &amp;quot;useridnumber&amp;quot; (assuming that your users have ID number fields filled in in their profiles).&lt;br /&gt;
## Tip: Unlike in most email programs, email addresses are case sensitive in grade import files.  (This should eventually be fixed as per MDL-29315.)&lt;br /&gt;
&lt;br /&gt;
You need two permissions to import grades: (1) general permission to import grades and (2) permission to import grades in a particular format. For example, to import CSV grades you need moodle/grade:import (&amp;quot;Import grades&amp;quot;) = Allow and gradeimport/csv:view (&amp;quot;Import grades from CSV&amp;quot;) = Allow&lt;br /&gt;
&lt;br /&gt;
==CSV import==&lt;br /&gt;
&lt;br /&gt;
CSV import is more flexible than XML import, as you may choose the column mapping.&lt;br /&gt;
&lt;br /&gt;
===Grade Mapping===&lt;br /&gt;
&lt;br /&gt;
After selecting your CSV for import you&#039;ll be prompted to map user fields and grade items to the new column headers to ensure that there is a match. More than one item can be mapped to the same grade item in your destination course so be mindful of the mapping to ensure that grade data is imported properly, any collisions (i.e. if two or more fields are mapped to the same but duplicate data exists) will cause an error. User grade data for users not yet enrolled to the destination course will be noted (and once enrolled their grade data will display).&lt;br /&gt;
&lt;br /&gt;
===Encoding===&lt;br /&gt;
&lt;br /&gt;
If you are unsure of the encoding of your CSV file, try selecting the second option in the encoding dropdown menu. If you&#039;ve used Excel to produce the CSV file the second option WINDOWS-xxx encoding is probably the correct one. The grade import preview will tell you if you guessed the encoding correctly.&lt;br /&gt;
&lt;br /&gt;
===Verbose scales===&lt;br /&gt;
&lt;br /&gt;
Scales can be either specified as a raw id - eg. 0, 1, 2, 3, etc. or as a string, eg. &amp;quot;good&amp;quot;, &amp;quot;bad&amp;quot;, &amp;quot;not very bad&amp;quot;. The later format is called &amp;quot;verbose&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Force import===&lt;br /&gt;
&lt;br /&gt;
Since 2.8 a new column &#039;&#039;&#039;Last downloaded from this course&#039;&#039;&#039; containing the time stamp of the exported date is present on every exported file. &lt;br /&gt;
This prevents grade overriding during the grade importing in a scenario where more than one teacher exports grades of a course and then import again. If a second teacher exports the grades and try to import the following error message will be displayed and the grade importing procedure will be aborted.&lt;br /&gt;
&amp;lt;pre&amp;gt;Student name grades have not been imported because the grades in the import file are older than in the grader report. To proceed with the grade import anyway, use the force import option.&amp;lt;/pre&amp;gt;  &lt;br /&gt;
Also, the grade importing will prevent the import of an old exported file (1 year ago) and future dates.&lt;br /&gt;
In cases that the teacher needs to import the grades anyway, we&#039;ve create an option called &#039;&#039;&#039;Force import&#039;&#039;&#039;. Using this option will avoid this date checking and the grade are imported.&lt;br /&gt;
&lt;br /&gt;
==Paste from spreadsheet==&lt;br /&gt;
&lt;br /&gt;
{{New features}}&lt;br /&gt;
Grades may be pasted directly from a spreadsheet such as Excel or Libre Office:&lt;br /&gt;
&lt;br /&gt;
1) Ensure you have the correct column names for your grades (eg the assignment title or manual grade) It might help to  download and edit the relevant students and graded information by using the [[Grade export]] feature.&lt;br /&gt;
&lt;br /&gt;
2) For the students you need either their username, their ID or their email address. Add the grades you need and copy the relevant section:&lt;br /&gt;
[[File:pastegrades1.png|thumb|center|400px]]&lt;br /&gt;
3) In your course, go to &#039;&#039;Grade administration&amp;gt;Import&amp;gt;Paste from spreadsheet&#039;&#039; and paste:&lt;br /&gt;
[[File:pastegrades2.png|thumb|center|400px]]&lt;br /&gt;
4) In the preview, ensure you match up the identifier you used for the students -so if you used &#039;username&#039;, ensure it maps to &#039;username&#039;. Do the same for your graded activities:&lt;br /&gt;
[[File:pastegrades3.png|thumb|400px|center]]&lt;br /&gt;
5) If everything has been correctly mapped (See grade mapping above), you should get a success message and the grades will have been added, displaying in a different colour to show they were imported directly into the gradebook:&lt;br /&gt;
{|&lt;br /&gt;
| [[File:pastegrades4.png|thumb|400px]]&lt;br /&gt;
| [[File:pastegrades5.png|thumb|400px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Paste from a spreadsheet requires similar permissions to a csv file import: (1) general permission to import grades and (2) permission to import grades in a particular format i.e. moodle/grade:import (&amp;quot;Import grades&amp;quot;) = Allow and gradeimport/direct:view (&amp;quot;Import grades from spreadsheet&amp;quot;) = Allow&lt;br /&gt;
&lt;br /&gt;
==XML import==&lt;br /&gt;
&lt;br /&gt;
Before importing an XML file you will need to ensure that all of the students that you want to alter grades for have their ID number field filled out. This is located in the &amp;quot;Optional&amp;quot; section of the user edit profile page.&lt;br /&gt;
You will also need to set the ID number of the activity as well. You can find this under &amp;quot;Common module settings&amp;quot; when editing the activity.&lt;br /&gt;
&lt;br /&gt;
The format for the XML should be as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;results&amp;gt;&lt;br /&gt;
    &amp;lt;result&amp;gt;&lt;br /&gt;
        &amp;lt;assignment&amp;gt;activityidnumber&amp;lt;/assignment&amp;gt;&lt;br /&gt;
        &amp;lt;student&amp;gt;studentidnumber&amp;lt;/student&amp;gt;&lt;br /&gt;
        &amp;lt;score&amp;gt;53.00&amp;lt;/score&amp;gt;&lt;br /&gt;
    &amp;lt;/result&amp;gt;&lt;br /&gt;
    &amp;lt;result&amp;gt;&lt;br /&gt;
        &amp;lt;assignment&amp;gt;differentactivityidnumber&amp;lt;/assignment&amp;gt;&lt;br /&gt;
        &amp;lt;student&amp;gt;studentidnumber&amp;lt;/student&amp;gt;&lt;br /&gt;
        &amp;lt;score&amp;gt;73.00&amp;lt;/score&amp;gt;&lt;br /&gt;
    &amp;lt;/result&amp;gt;&lt;br /&gt;
&amp;lt;/results&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a working example try exporting the gradebook as an xml file and view the format.&lt;br /&gt;
&lt;br /&gt;
===Remote file URL===&lt;br /&gt;
&lt;br /&gt;
The remote file URL field is for fetching data from a remote server, such as a student information system.&lt;br /&gt;
&lt;br /&gt;
==Grade import capabilities==&lt;br /&gt;
&lt;br /&gt;
* [[Capabilities/gradeimport/csv:view|Import grades from CSV]]&lt;br /&gt;
* [[Capabilities/gradeimport/xml:publish|Publish import grades from XML]]&lt;br /&gt;
* [[Capabilities/gradeimport/xml:view|Import grades from XML]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=85944 Gradebook confusion]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=92081 Can external software insert data into the gradebook?]&lt;br /&gt;
&lt;br /&gt;
[[ja:評定のインポート]]&lt;br /&gt;
[[de:Bewertungen importieren]]&lt;br /&gt;
[[es:Importar calificaciones]]&lt;br /&gt;
[[fr:Importation des notes]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Administration_via_command_line&amp;diff=116959</id>
		<title>Administration via command line</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Administration_via_command_line&amp;diff=116959"/>
		<updated>2015-02-09T08:31:59Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* Tool for converting innodb tables to Barracuda */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
If you have shell access to your web server, you may find various CLI (command line interface) scripts useful during Moodle administration. Core admin CLI tools are located in the &amp;lt;code&amp;gt;admin/cli/*&amp;lt;/code&amp;gt; folder. Other plugins provide their CLI functionality via scripts in their own cli folder. For example, the enrol_db sync script is located in &amp;lt;code&amp;gt;enrol/db/cli/&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid problems with access control, you should run them as the owner of the web server process. It is especially important for CLI installation and upgrade as they create new files in moodledata directory and the web server has to have write access to them. In Linux distributions, the user that runs the web server is usually apache or wwrun or httpd or something similar. As a root, you will probably want to execute Moodle CLI scripts like this:&lt;br /&gt;
&lt;br /&gt;
    $ cd /path/to/your/moodle/dir&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/somescript.php --params&lt;br /&gt;
&lt;br /&gt;
Most of the scripts accept common --help (or -h) parameter to display the full usage information, for example:&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/install.php --help&lt;br /&gt;
&lt;br /&gt;
== Upgrading via command line ==&lt;br /&gt;
&lt;br /&gt;
Moodle can be upgraded from the command line. As with the installation script, there is either interactive or non-interactive mode of the upgrade. The script itself does not put the site into the maintenance mode, you have to do it on your own. Also, the script does not backup any data (if you read this page, you probably have some own scripts to backup your moodledata and the database, right?)&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/upgrade.php&lt;br /&gt;
&lt;br /&gt;
Upgrading via command line is a very comfortable way of Moodle upgrade if you use Git checkout of the Moodle source code (see [[Git for Administrators]]). See the following procedure how to upgrade your site within several seconds to the most recent version while preserving your eventual local customizations tracked in git repository:&lt;br /&gt;
&lt;br /&gt;
    $ cd /var/www/sites/moodle/htdocs/&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --enable&lt;br /&gt;
    $ git pull&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/upgrade.php&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --disable&lt;br /&gt;
&lt;br /&gt;
== Installation via command line ==&lt;br /&gt;
&lt;br /&gt;
Since version 2.0, Moodle can be installed from the command line. There are two modes of installation. In interactive mode, the install script asks you for all data needed to properly set up new Moodle site. In non-interactive mode, you must provide all required data as the script parameters and then the new site is installed silently. The parameters can be passed in the interactive mode, too. The provided values are then used as the default values during the interactive session.&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/install.php --lang=cs&lt;br /&gt;
&lt;br /&gt;
== Maintenance mode ==&lt;br /&gt;
&lt;br /&gt;
To switch your site into the maintenance mode via CLI, you can use&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --enable&lt;br /&gt;
&lt;br /&gt;
To turn the maintenance mode off, just execute the same script with --disable parameter.&lt;br /&gt;
&lt;br /&gt;
== Offline mode ==&lt;br /&gt;
&lt;br /&gt;
In some situations, you may want to switch your Moodle site into offline mode so that it is not accessible via the web but you can not stop the web server completely (typically because there are other web pages and applications running there). If a file called &amp;lt;code&amp;gt;climaintenance.html&amp;lt;/code&amp;gt; exists in the root folder of moodledata directory, Moodle will automatically display the contents of that file instead of any other page.&lt;br /&gt;
&lt;br /&gt;
    $ cd /var/www/sites/moodle/moodledata/&lt;br /&gt;
    $ echo &#039;&amp;amp;lt;h1&amp;amp;gt;Sorry, maintenance in progress&amp;amp;lt;/h1&amp;amp;gt;&#039; &amp;amp;gt; climaintenance.html&lt;br /&gt;
&lt;br /&gt;
You can prepare a nice formatted HTML page to inform your users about the server being down and keep in the moodledata directory under a name like &amp;lt;code&amp;gt;climaintenance.off&amp;lt;/code&amp;gt; and rename it to the &amp;lt;code&amp;gt;climaintenance.html&amp;lt;/code&amp;gt; if needed.&lt;br /&gt;
&lt;br /&gt;
== Custom site defaults ==&lt;br /&gt;
&lt;br /&gt;
During the install and upgrade via CLI, Moodle sets the administration variables to the default values. You can use different defaults. See MDL-17850 for details. Shortly, all you need to do is to add a file &amp;lt;code&amp;gt;local/defaults.php&amp;lt;/code&amp;gt; into your Moodle installation. The format of the file is like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$defaults[&#039;pluginname&#039;][&#039;settingname&#039;] = &#039;settingvalue&#039;; // for plugins&lt;br /&gt;
$defaults[&#039;moodle&#039;][&#039;settingname&#039;] = &#039;settingvalue&#039;;     // for core settings&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These defaults are used during install, upgrade and are also displayed as defaults at the Site administration pages.&lt;br /&gt;
&lt;br /&gt;
== Reset user password ==&lt;br /&gt;
&lt;br /&gt;
If you happen to forget your admin password (or you want to set a password for any other user of your Moodle system), you can use reset_password.php script. The script sets the correctly salted password for the given user.&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/reset_password.php&lt;br /&gt;
&lt;br /&gt;
== MySQL storage engine conversion ==&lt;br /&gt;
&lt;br /&gt;
If you run your Moodle site with MySQL database backend and use the default MyISAM as the storage engine for your tables, you may want to convert them to use some more reliable engine like InnoDB (actually, you should want to switch to PostgreSQL ;-) anyway).&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/mysql_engine.php --engine=InnoDB&lt;br /&gt;
&lt;br /&gt;
== Running cron via command line ==&lt;br /&gt;
&lt;br /&gt;
In versions 1.x, you could execute admin/cron.php either from command line or via the web. Since Moodle 2.0, only admin/cli/cron.php script can be run via command line.&lt;br /&gt;
&lt;br /&gt;
== Scheduled tasks ==&lt;br /&gt;
&lt;br /&gt;
Since Moodle 2.7&lt;br /&gt;
&lt;br /&gt;
Scheduled tasks are automatically run by the cron script above, but the specific tasks which run on each cron iteration are determined by the scheduled tasks configuration. It is possible to override the scheduled tasks configuration and run a single scheduled task immediately using the admin/tool/task/cli/schedule_task.php script. &lt;br /&gt;
&lt;br /&gt;
This script accepts the following arguments:&lt;br /&gt;
&lt;br /&gt;
 --list - list all the known scheduled tasks. The tasks are listed by the class name used to run the task. This class name is required as the argument to the next option in order to run a specific task immediately.&lt;br /&gt;
&lt;br /&gt;
 --execute=&amp;lt;task&amp;gt; - Runs a single scheduled task immediately - regardless of scheduling settings. This will even run disabled tasks. Tasks will still use locking to prevent concurrent execution of the same task - even on clusters. The format of the &amp;lt;task&amp;gt; argument must be the same as returned by the --list option above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; You must escape the &amp;quot;\&amp;quot; with an extra \ when using the --execute command. Take the following for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;php schedule_task.php --list&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will return something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
== List of scheduled tasks (http://yourserver.com/moodle) ==&lt;br /&gt;
\enrol_imsenterprise\task\cron_task                10 * * * * *      ASAP&lt;br /&gt;
\logstore_legacy\task\cleanup_task                 * 5 * * * *       ASAP&lt;br /&gt;
\logstore_standard\task\cleanup_task               * 4 * * * *       Wednesday, November 12, 2014, 4:35 AM&lt;br /&gt;
\mod_forum\task\cron_task                          * * * * * *       ASAP&lt;br /&gt;
\core\task\automated_backup_task                   50 * * * * *      ASAP&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run the first task in that list, you would execute&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;php schedule_task.php --execute=\\enrol_imsenterprise\\task\\cron_task&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Database transfer==&lt;br /&gt;
&lt;br /&gt;
A command line script for [[Database transfer]] may be found in &#039;&#039;admin/tool/dbtransfer/cli/migrate.php&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Update user pictures via command line==&lt;br /&gt;
&lt;br /&gt;
   http://moodle.org/pluginfile.php/143/mod_forum/attachment/926929/updatepics.php &lt;br /&gt;
Tested for 2.3.1+&lt;br /&gt;
&lt;br /&gt;
Place this file in /admin/cli/updatepics.php&lt;br /&gt;
&lt;br /&gt;
How to use:&lt;br /&gt;
Run with &amp;quot;dir&amp;quot; option to specify which directory contains the files.&lt;br /&gt;
&lt;br /&gt;
   .../admin/cli/updatepics.php --dir=PATH_TO_DIR&lt;br /&gt;
&lt;br /&gt;
* File names must be identical to usernames&lt;br /&gt;
&lt;br /&gt;
==Manage MOD&#039;s,Blocks via command line==&lt;br /&gt;
&lt;br /&gt;
Here are two scripts to help you manage your plugins.&lt;br /&gt;
&lt;br /&gt;
   http://tracker.moodle.org/browse/MDL-35736&lt;br /&gt;
&lt;br /&gt;
How to use &amp;quot;manage_blocks.php&amp;quot;:&lt;br /&gt;
place in /admin/cli&lt;br /&gt;
&lt;br /&gt;
hide:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --hide&lt;br /&gt;
&lt;br /&gt;
show:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --show&lt;br /&gt;
&lt;br /&gt;
delete:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --delete&lt;br /&gt;
&lt;br /&gt;
protect:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --protect&lt;br /&gt;
&lt;br /&gt;
unprotect:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --unprotect&lt;br /&gt;
&lt;br /&gt;
(obviously - replace &amp;quot;tag_youtube&amp;quot; with the blockthat you want to remove...)&lt;br /&gt;
&lt;br /&gt;
How to use &amp;quot;manage_mods.php&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
hide:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --hide&lt;br /&gt;
&lt;br /&gt;
show:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --show&lt;br /&gt;
&lt;br /&gt;
delete:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --delete&lt;br /&gt;
&lt;br /&gt;
*Important!&lt;br /&gt;
this script does not delete the relevant folder in /moodle/mod or /moodle/blocks&lt;br /&gt;
&lt;br /&gt;
you have to delete it yourself !&lt;br /&gt;
&lt;br /&gt;
==Update language pack via CLI==&lt;br /&gt;
&lt;br /&gt;
  http://tracker.moodle.org/browse/MDL-35735&lt;br /&gt;
&lt;br /&gt;
Place attached file in /admin/cli&lt;br /&gt;
and simply run it, without any command-line arguments :)&lt;br /&gt;
&lt;br /&gt;
==ReSort course list via CLI==&lt;br /&gt;
&lt;br /&gt;
  http://tracker.moodle.org/browse/MDL-36237&lt;br /&gt;
&lt;br /&gt;
Place attached file in /admin/cli&lt;br /&gt;
and simply run it, without any command-line arguments :)&lt;br /&gt;
&lt;br /&gt;
I import courses every night from an external system, and run this script afterwards&lt;br /&gt;
&lt;br /&gt;
==Purge caches via CLI==&lt;br /&gt;
&lt;br /&gt;
You can purge caches using this script:&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/purge_caches.php&lt;br /&gt;
&lt;br /&gt;
==Tool for converting innodb tables to Barracuda==&lt;br /&gt;
&lt;br /&gt;
Some users are getting the following MySQL error during the course restoration procedure:&lt;br /&gt;
&lt;br /&gt;
  Row size too large (&amp;gt;8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help.&lt;br /&gt;
&lt;br /&gt;
This affect all moodle versions and is due MySQL default InnoDB file format (Antelope) cannot handle more than 10 text columns. We strongly recommend you change the InnoDB file format to Barracuda.&lt;br /&gt;
&lt;br /&gt;
Since 2.6 onwards we have a specific tool to help users on this conversion. Please use the command below to do the database change.&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/mysql_compressed_rows.php&lt;br /&gt;
&lt;br /&gt;
More information about InnoDB file formats can be found here:&lt;br /&gt;
  http://dev.mysql.com/doc/innodb/1.1/en/glossary.html#glos_antelope&lt;br /&gt;
  http://dev.mysql.com/doc/innodb/1.1/en/glossary.html#glos_barracuda&lt;br /&gt;
&lt;br /&gt;
[[fr:Administration en ligne de commande]]&lt;br /&gt;
[[de:Administration über Kommandozeile]]&lt;br /&gt;
[[ja:コマンドライン経由の管理]]&lt;br /&gt;
[[es:Administración por línea de comando]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Upgrading&amp;diff=116958</id>
		<title>Upgrading</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Upgrading&amp;diff=116958"/>
		<updated>2015-02-09T08:31:35Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* MySQL dmlwriteexceptionerror exception throw on course restoration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}	&lt;br /&gt;
&#039;&#039;This page explains in detail how to upgrade Moodle. For a summary of the process, see [[Upgrade overview]].&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Check the requirements==&lt;br /&gt;
&lt;br /&gt;
Check that your server meets all requirements for 2.8 in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Server &amp;gt; [[Environment]]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Note: You can only upgrade to Moodle 2.8 from Moodle 2.2 or later. If upgrading from earlier versions, you must [https://docs.moodle.org/22/en/Upgrading_to_Moodle_2.2 upgrade to 2.2] as a first step.&lt;br /&gt;
&lt;br /&gt;
==Before upgrading==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;We advise that you test the upgrade first on a COPY of your production site, to make sure it works as you expect.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Backup important data ==&lt;br /&gt;
&lt;br /&gt;
There are three areas that should be backed up before any upgrade:&lt;br /&gt;
#Moodle software (For example, everything in server/htdocs/moodle)&lt;br /&gt;
#Moodle uploaded files (For example, server/moodledata)&lt;br /&gt;
#Moodle database (For example, your Postgres or MySQL database dump)&lt;br /&gt;
&lt;br /&gt;
See [[Site backup]] for more specific information.&lt;br /&gt;
&lt;br /&gt;
==Put your site into maintenance mode==&lt;br /&gt;
Before you begin upgrading your site, you should put it into [[Maintenance_mode | maintenance mode]] to stop any non-admin users from logging in.&lt;br /&gt;
&lt;br /&gt;
== Check for plugin updates ==&lt;br /&gt;
&lt;br /&gt;
If you have [[Automatic updates deployment]] enabled, you will be able to update installed plugins automatically during the upgrade. Just make sure you check for available updates (via the button for it) at the Plugins check screen.&lt;br /&gt;
&lt;br /&gt;
If you are updating plugins manually, it is a good moment now to check in the [http://moodle.org/plugins Moodle Plugins directory] whether there is a 2.8 version available for any plugins (including themes) that you have previously installed on your site. If so, download the plugin package. In the next step, you will copy it to the appropriate location in your Moodle code (see [[Installing plugins]]).&lt;br /&gt;
&lt;br /&gt;
The upgrade of the plugin will then happen as part of the Moodle upgrade process.&lt;br /&gt;
&lt;br /&gt;
If an out-of-date plugin causes your upgrade to fail, you can usually delete the plugin code rather than uninstalling it from within Moodle so that the data associated with it is not deleted.&lt;br /&gt;
&lt;br /&gt;
== Install the new Moodle software ==&lt;br /&gt;
You can fetch the current (2.8) version of the software through &lt;br /&gt;
&lt;br /&gt;
wget http://sourceforge.net/projects/moodle/files/Moodle/stable28/moodle-latest-28.tgz&lt;br /&gt;
&lt;br /&gt;
=== Standard install package ===&lt;br /&gt;
&lt;br /&gt;
# Move your old Moodle software program files to another location. &#039;&#039;Do NOT copy new files over the old files.&#039;&#039;&lt;br /&gt;
# Unzip or unpack the upgrade file so that all the new Moodle software program files are in the location the old files used to be in on the server. Moodle will adjust SQL and moodledata if it needs to in the upgrade.&lt;br /&gt;
# Copy your old [[Configuration file|config.php file]] back to the new Moodle directory. &lt;br /&gt;
# As mentioned above, if you had installed any plugins on your site you should add them to the new code tree now. It is important to check that you get the correct version for your new version of Moodle. Be particularly careful that you do not overwrite any code in the new version of Moodle.&lt;br /&gt;
# Dont forget to also copy over your moodledata folder / directory.  If you don&#039;t you will get a &amp;quot;fatal error $cfg- dataroot is not configured properly&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
 mv moodle moodle.backup&lt;br /&gt;
 tar xvzf moodle-2.8.tgz&lt;br /&gt;
&lt;br /&gt;
Next, copy across your config.php, any custom plugins, and your .htaccess file if you created one (&#039;&#039;&#039;check that custom plugins are the correct version for your new Moodle first&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 cp moodle.backup/config.php moodle&lt;br /&gt;
 cp -pr moodle.backup/theme/mytheme moodle/theme/mytheme&lt;br /&gt;
 cp -pr moodle.backup/mod/mymod moodle/mod/mymod&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to make moodle/config.php (and the rest of the source code) readable by your www server. Ideally the files should not be writeable by your server.&lt;br /&gt;
&lt;br /&gt;
If you use cron, take care that cron.php is executeable and uses the correct php command: &lt;br /&gt;
 chmod 740 admin/cli/cron.php (some configurations need chmod 750 or chmod 755)&lt;br /&gt;
 copy the first line from cron.php (if it looks like &#039;#!/usr/local/bin/php&#039; or &#039;#!/usr/local/bin/php5.3&#039;, no need to copy &#039;&amp;lt;?php&#039;)&lt;br /&gt;
&lt;br /&gt;
if necessary.&lt;br /&gt;
&lt;br /&gt;
=== Using Git ===&lt;br /&gt;
&lt;br /&gt;
You can use Git for updating or upgrading your Moodle. See [[Git for Administrators]] for details.&lt;br /&gt;
&lt;br /&gt;
===Command line upgrade===&lt;br /&gt;
&lt;br /&gt;
On Linux servers, Moodle 2.8 supports running the [[CLI|upgrade from the command line]], rather than through a web browser. This is likely to be more reliable, particularly for large sites.&lt;br /&gt;
&lt;br /&gt;
== Finishing the upgrade ==&lt;br /&gt;
&lt;br /&gt;
The last step is to trigger the upgrade processes within Moodle. &lt;br /&gt;
&lt;br /&gt;
To do this just go to &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Notifications&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Moodle will automatically detect the new version and perform all the SQL database or file system upgrades that are necessary. If there is anything it can&#039;t do itself (very rare) then you will see messages telling you what you need to do.&lt;br /&gt;
&lt;br /&gt;
Assuming all goes well (no error messages) then you can start using your new version of Moodle and enjoy the new features!&lt;br /&gt;
&lt;br /&gt;
Note: If you are running multiple servers then you should purge all caches manually (via &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Development &amp;gt; Purge all caches&#039;&#039;) after completing the upgrade on all servers.&lt;br /&gt;
&lt;br /&gt;
===Fatal error: Maximum execution time of 30 seconds exceeded...===&lt;br /&gt;
&lt;br /&gt;
If your server uses a main language other than English, you may encounter a &#039;Fatal error: Maximum execution time of 30 seconds exceeded&#039; when you try to upgrade it. You can increase max_execution_time = 160 on php.ini to allow the scripts enough time to process the language update. Otherwise, you can switch to English as the default language before doing the upgrade and back to your original language after a succcessful upgrade. See the forum discussion at https://moodle.org/mod/forum/discuss.php?d=119598.&lt;br /&gt;
&lt;br /&gt;
==After upgrading==&lt;br /&gt;
&lt;br /&gt;
The config.php file from your installation should work fine but if you take a look at config-dist.php that came with Moodle 2.8 there are more/different options available (e.g. database drivers and settings). It&#039;s a good idea to map your old config.php settings to a new one based on the 2.8 config-dist.php.&lt;br /&gt;
&lt;br /&gt;
===Cron===&lt;br /&gt;
&lt;br /&gt;
Cron has received a major update (MDL-25499) and now has support for both scheduled and adhoc tasks.&lt;br /&gt;
&lt;br /&gt;
The benefits of these changes are:&lt;br /&gt;
* The schedule for every task can be configured by the admin&lt;br /&gt;
* Tasks can run in parallel&lt;br /&gt;
* Cron processes use locking to prevent the same task running at the same time by different processes&lt;br /&gt;
* Clusters with multiple identical application nodes are supported, you can run cron on all of them&lt;br /&gt;
&lt;br /&gt;
A result of this is that cron can be run much more often, which means (for example) forum posts can be sent out sooner.  To take advantage of the new cron system it is now strongly recommended that administrators increase the frequency that cron is run to at least &#039;&#039;once per minute&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You also may need to modify any automated scripts you have that are parsing the output from cron. It is no longer possible to simply monitor the output of cron for the string &amp;quot;Cron script completed correctly&amp;quot; (if that is what you were doing). An alternative is to monitor the output for the string &amp;quot;task failed:&amp;quot;. If you detect that a task is failing, [[Cron#Debugging_Scheduled_Tasks|here]] are some tips for debugging the failure. &lt;br /&gt;
&lt;br /&gt;
Before the upgrade to 2.8, there may have been a cron task that was failing, which was preventing the rest of cron from being executed. A failure in any single task will no longer prevent the rest of the Moodle cron tasks from executing, so you may uncover previously masked bugs. It is a good idea to closely monitor the output from cron after the upgrade to 2.8.&lt;br /&gt;
&lt;br /&gt;
===Assignments===&lt;br /&gt;
&lt;br /&gt;
The old assignment (2.2) module has been removed from core and has been replaced by a stub to support transparently remapping URLs and restoring course backups from the old module to the new one. &lt;br /&gt;
&lt;br /&gt;
If you are still using the old assignment (2.2) module, after upgrading to Moodle 2.8 all assignment (2.2) activities will be hidden. You need to run the [[Assignment upgrade tool]] to un-hide the activities.&lt;br /&gt;
&lt;br /&gt;
If you really, really need to keep using the old assignment (2.2) module, you should update the code to Moodle 2.8, and then replace the &amp;quot;mod/assignment&amp;quot; folder with the one from https://github.com/moodlehq/moodle-mod_assignment/releases before completing the upgrade.&lt;br /&gt;
&lt;br /&gt;
==Possible issues that may affect you in Moodle 2.8==&lt;br /&gt;
&lt;br /&gt;
===New aggregation method - &#039;Natural&#039;===&lt;br /&gt;
&lt;br /&gt;
The aggregation method &#039;Sum of grades&#039; used in the [[Grades|gradebook]] has been reviewed, significantly improved and renamed to &#039;Natural&#039;. It is recommended that &#039;Natural&#039; is set as the default aggregation method, as for new Moodle 2.8 installs.&lt;br /&gt;
&lt;br /&gt;
In addition, the aggregation setting &#039;Aggregate including subcategories&#039; has been removed.&lt;br /&gt;
&lt;br /&gt;
Any courses previously using either &#039;Sum of grades&#039; and/or &#039;Aggregate including subcategories&#039; may have some changes to grades. Thus it is recommended that grades in the gradebook are reviewed for such courses.&lt;br /&gt;
&lt;br /&gt;
===Teachers able to enrol users via the cohort sync enrolment method===&lt;br /&gt;
&lt;br /&gt;
Teachers will get access to [[Cohort sync]] enrolment method if it is enabled, remove capability to use this enrolment method from teachers if you want to preserve 2.7 behaviour. See MDL-36014&lt;br /&gt;
&lt;br /&gt;
===Gradebook scrolling and theme issues===&lt;br /&gt;
Themes with non-fixed headers must have the .navbar class in their navbar in order for floating headers in the grader report to work - see MDL-46658 for more information.&lt;br /&gt;
&lt;br /&gt;
===Removal of the &#039;Group members only&#039; experimental setting===&lt;br /&gt;
&lt;br /&gt;
The experimental setting &#039;Group members only&#039; has been removed in Moodle 2.8. The group and grouping restrictions in [[Conditional activities settings|conditional activities]] now provide this functionality. Any &#039;Available for group members only&#039; instances are automatically converted to group or grouping restrictions when a site is upgraded.&lt;br /&gt;
&lt;br /&gt;
* &#039;Available for group members only&#039; instances with no grouping selected are converted to a &#039;Must belong to any group&#039; restriction.&lt;br /&gt;
* &#039;Available for group members only&#039; instances with a grouping specified are converted to a &#039;Must belong to the specific grouping&#039; restriction.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;More items to be added here...&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== MySQL dmlwriteexceptionerror exception throw on course restoration ===&lt;br /&gt;
&lt;br /&gt;
Some users are getting the following MySQL error during the course restoration procedure:&lt;br /&gt;
&lt;br /&gt;
  Row size too large (&amp;gt;8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help.&lt;br /&gt;
&lt;br /&gt;
This affect all moodle versions and is due MySQL default InnoDB file format (Antelope) cannot handle more than 10 text columns. We strongly recommend you change the InnoDB file format to Barracuda.&lt;br /&gt;
&lt;br /&gt;
Since 2.6 onwards we have a specific tool to help users on this conversion. Please use the command below to do the database change.&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/mysql_compressed_rows.php&lt;br /&gt;
&lt;br /&gt;
More information about InnoDB file formats can be found here:&lt;br /&gt;
  http://dev.mysql.com/doc/innodb/1.1/en/glossary.html#glos_antelope&lt;br /&gt;
  http://dev.mysql.com/doc/innodb/1.1/en/glossary.html#glos_barracuda&lt;br /&gt;
&lt;br /&gt;
=== Moodle 2.3, 2.4, 2.5, 2.6 and 2.7 improvements ===&lt;br /&gt;
&lt;br /&gt;
Depending on which version you are upgrading from, please see the section &#039;Possible issues that may affect you&#039; in the documentation&lt;br /&gt;
&lt;br /&gt;
* [https://docs.moodle.org/23/en/Upgrading Upgrading to Moodle 2.3]&lt;br /&gt;
* [https://docs.moodle.org/24/en/Upgrading Upgrading to Moodle 2.4]&lt;br /&gt;
* [https://docs.moodle.org/25/en/Upgrading Upgrading to Moodle 2.5]&lt;br /&gt;
* [https://docs.moodle.org/26/en/Upgrading Upgrading to Moodle 2.6]&lt;br /&gt;
* [https://docs.moodle.org/27/en/Upgrading Upgrading to Moodle 2.7]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Installation]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?id=28 Installation problems forum] &lt;br /&gt;
* [[dev:Moodle 2.8 release notes|Moodle 2.8 release notes]]&lt;br /&gt;
&lt;br /&gt;
[[es:Actualización de moodle]]&lt;br /&gt;
[[fr:Mise à jour]]&lt;br /&gt;
[[ja:Moodleをアップグレードする]]&lt;br /&gt;
[[de:Aktualisierung von Moodle]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Upgrading&amp;diff=116957</id>
		<title>Upgrading</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Upgrading&amp;diff=116957"/>
		<updated>2015-02-09T08:30:31Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* Possible issues that may affect you in Moodle 2.8 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}	&lt;br /&gt;
&#039;&#039;This page explains in detail how to upgrade Moodle. For a summary of the process, see [[Upgrade overview]].&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Check the requirements==&lt;br /&gt;
&lt;br /&gt;
Check that your server meets all requirements for 2.8 in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Server &amp;gt; [[Environment]]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Note: You can only upgrade to Moodle 2.8 from Moodle 2.2 or later. If upgrading from earlier versions, you must [https://docs.moodle.org/22/en/Upgrading_to_Moodle_2.2 upgrade to 2.2] as a first step.&lt;br /&gt;
&lt;br /&gt;
==Before upgrading==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;We advise that you test the upgrade first on a COPY of your production site, to make sure it works as you expect.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Backup important data ==&lt;br /&gt;
&lt;br /&gt;
There are three areas that should be backed up before any upgrade:&lt;br /&gt;
#Moodle software (For example, everything in server/htdocs/moodle)&lt;br /&gt;
#Moodle uploaded files (For example, server/moodledata)&lt;br /&gt;
#Moodle database (For example, your Postgres or MySQL database dump)&lt;br /&gt;
&lt;br /&gt;
See [[Site backup]] for more specific information.&lt;br /&gt;
&lt;br /&gt;
==Put your site into maintenance mode==&lt;br /&gt;
Before you begin upgrading your site, you should put it into [[Maintenance_mode | maintenance mode]] to stop any non-admin users from logging in.&lt;br /&gt;
&lt;br /&gt;
== Check for plugin updates ==&lt;br /&gt;
&lt;br /&gt;
If you have [[Automatic updates deployment]] enabled, you will be able to update installed plugins automatically during the upgrade. Just make sure you check for available updates (via the button for it) at the Plugins check screen.&lt;br /&gt;
&lt;br /&gt;
If you are updating plugins manually, it is a good moment now to check in the [http://moodle.org/plugins Moodle Plugins directory] whether there is a 2.8 version available for any plugins (including themes) that you have previously installed on your site. If so, download the plugin package. In the next step, you will copy it to the appropriate location in your Moodle code (see [[Installing plugins]]).&lt;br /&gt;
&lt;br /&gt;
The upgrade of the plugin will then happen as part of the Moodle upgrade process.&lt;br /&gt;
&lt;br /&gt;
If an out-of-date plugin causes your upgrade to fail, you can usually delete the plugin code rather than uninstalling it from within Moodle so that the data associated with it is not deleted.&lt;br /&gt;
&lt;br /&gt;
== Install the new Moodle software ==&lt;br /&gt;
You can fetch the current (2.8) version of the software through &lt;br /&gt;
&lt;br /&gt;
wget http://sourceforge.net/projects/moodle/files/Moodle/stable28/moodle-latest-28.tgz&lt;br /&gt;
&lt;br /&gt;
=== Standard install package ===&lt;br /&gt;
&lt;br /&gt;
# Move your old Moodle software program files to another location. &#039;&#039;Do NOT copy new files over the old files.&#039;&#039;&lt;br /&gt;
# Unzip or unpack the upgrade file so that all the new Moodle software program files are in the location the old files used to be in on the server. Moodle will adjust SQL and moodledata if it needs to in the upgrade.&lt;br /&gt;
# Copy your old [[Configuration file|config.php file]] back to the new Moodle directory. &lt;br /&gt;
# As mentioned above, if you had installed any plugins on your site you should add them to the new code tree now. It is important to check that you get the correct version for your new version of Moodle. Be particularly careful that you do not overwrite any code in the new version of Moodle.&lt;br /&gt;
# Dont forget to also copy over your moodledata folder / directory.  If you don&#039;t you will get a &amp;quot;fatal error $cfg- dataroot is not configured properly&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
 mv moodle moodle.backup&lt;br /&gt;
 tar xvzf moodle-2.8.tgz&lt;br /&gt;
&lt;br /&gt;
Next, copy across your config.php, any custom plugins, and your .htaccess file if you created one (&#039;&#039;&#039;check that custom plugins are the correct version for your new Moodle first&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 cp moodle.backup/config.php moodle&lt;br /&gt;
 cp -pr moodle.backup/theme/mytheme moodle/theme/mytheme&lt;br /&gt;
 cp -pr moodle.backup/mod/mymod moodle/mod/mymod&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to make moodle/config.php (and the rest of the source code) readable by your www server. Ideally the files should not be writeable by your server.&lt;br /&gt;
&lt;br /&gt;
If you use cron, take care that cron.php is executeable and uses the correct php command: &lt;br /&gt;
 chmod 740 admin/cli/cron.php (some configurations need chmod 750 or chmod 755)&lt;br /&gt;
 copy the first line from cron.php (if it looks like &#039;#!/usr/local/bin/php&#039; or &#039;#!/usr/local/bin/php5.3&#039;, no need to copy &#039;&amp;lt;?php&#039;)&lt;br /&gt;
&lt;br /&gt;
if necessary.&lt;br /&gt;
&lt;br /&gt;
=== Using Git ===&lt;br /&gt;
&lt;br /&gt;
You can use Git for updating or upgrading your Moodle. See [[Git for Administrators]] for details.&lt;br /&gt;
&lt;br /&gt;
===Command line upgrade===&lt;br /&gt;
&lt;br /&gt;
On Linux servers, Moodle 2.8 supports running the [[CLI|upgrade from the command line]], rather than through a web browser. This is likely to be more reliable, particularly for large sites.&lt;br /&gt;
&lt;br /&gt;
== Finishing the upgrade ==&lt;br /&gt;
&lt;br /&gt;
The last step is to trigger the upgrade processes within Moodle. &lt;br /&gt;
&lt;br /&gt;
To do this just go to &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Notifications&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Moodle will automatically detect the new version and perform all the SQL database or file system upgrades that are necessary. If there is anything it can&#039;t do itself (very rare) then you will see messages telling you what you need to do.&lt;br /&gt;
&lt;br /&gt;
Assuming all goes well (no error messages) then you can start using your new version of Moodle and enjoy the new features!&lt;br /&gt;
&lt;br /&gt;
Note: If you are running multiple servers then you should purge all caches manually (via &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Development &amp;gt; Purge all caches&#039;&#039;) after completing the upgrade on all servers.&lt;br /&gt;
&lt;br /&gt;
===Fatal error: Maximum execution time of 30 seconds exceeded...===&lt;br /&gt;
&lt;br /&gt;
If your server uses a main language other than English, you may encounter a &#039;Fatal error: Maximum execution time of 30 seconds exceeded&#039; when you try to upgrade it. You can increase max_execution_time = 160 on php.ini to allow the scripts enough time to process the language update. Otherwise, you can switch to English as the default language before doing the upgrade and back to your original language after a succcessful upgrade. See the forum discussion at https://moodle.org/mod/forum/discuss.php?d=119598.&lt;br /&gt;
&lt;br /&gt;
==After upgrading==&lt;br /&gt;
&lt;br /&gt;
The config.php file from your installation should work fine but if you take a look at config-dist.php that came with Moodle 2.8 there are more/different options available (e.g. database drivers and settings). It&#039;s a good idea to map your old config.php settings to a new one based on the 2.8 config-dist.php.&lt;br /&gt;
&lt;br /&gt;
===Cron===&lt;br /&gt;
&lt;br /&gt;
Cron has received a major update (MDL-25499) and now has support for both scheduled and adhoc tasks.&lt;br /&gt;
&lt;br /&gt;
The benefits of these changes are:&lt;br /&gt;
* The schedule for every task can be configured by the admin&lt;br /&gt;
* Tasks can run in parallel&lt;br /&gt;
* Cron processes use locking to prevent the same task running at the same time by different processes&lt;br /&gt;
* Clusters with multiple identical application nodes are supported, you can run cron on all of them&lt;br /&gt;
&lt;br /&gt;
A result of this is that cron can be run much more often, which means (for example) forum posts can be sent out sooner.  To take advantage of the new cron system it is now strongly recommended that administrators increase the frequency that cron is run to at least &#039;&#039;once per minute&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You also may need to modify any automated scripts you have that are parsing the output from cron. It is no longer possible to simply monitor the output of cron for the string &amp;quot;Cron script completed correctly&amp;quot; (if that is what you were doing). An alternative is to monitor the output for the string &amp;quot;task failed:&amp;quot;. If you detect that a task is failing, [[Cron#Debugging_Scheduled_Tasks|here]] are some tips for debugging the failure. &lt;br /&gt;
&lt;br /&gt;
Before the upgrade to 2.8, there may have been a cron task that was failing, which was preventing the rest of cron from being executed. A failure in any single task will no longer prevent the rest of the Moodle cron tasks from executing, so you may uncover previously masked bugs. It is a good idea to closely monitor the output from cron after the upgrade to 2.8.&lt;br /&gt;
&lt;br /&gt;
===Assignments===&lt;br /&gt;
&lt;br /&gt;
The old assignment (2.2) module has been removed from core and has been replaced by a stub to support transparently remapping URLs and restoring course backups from the old module to the new one. &lt;br /&gt;
&lt;br /&gt;
If you are still using the old assignment (2.2) module, after upgrading to Moodle 2.8 all assignment (2.2) activities will be hidden. You need to run the [[Assignment upgrade tool]] to un-hide the activities.&lt;br /&gt;
&lt;br /&gt;
If you really, really need to keep using the old assignment (2.2) module, you should update the code to Moodle 2.8, and then replace the &amp;quot;mod/assignment&amp;quot; folder with the one from https://github.com/moodlehq/moodle-mod_assignment/releases before completing the upgrade.&lt;br /&gt;
&lt;br /&gt;
==Possible issues that may affect you in Moodle 2.8==&lt;br /&gt;
&lt;br /&gt;
===New aggregation method - &#039;Natural&#039;===&lt;br /&gt;
&lt;br /&gt;
The aggregation method &#039;Sum of grades&#039; used in the [[Grades|gradebook]] has been reviewed, significantly improved and renamed to &#039;Natural&#039;. It is recommended that &#039;Natural&#039; is set as the default aggregation method, as for new Moodle 2.8 installs.&lt;br /&gt;
&lt;br /&gt;
In addition, the aggregation setting &#039;Aggregate including subcategories&#039; has been removed.&lt;br /&gt;
&lt;br /&gt;
Any courses previously using either &#039;Sum of grades&#039; and/or &#039;Aggregate including subcategories&#039; may have some changes to grades. Thus it is recommended that grades in the gradebook are reviewed for such courses.&lt;br /&gt;
&lt;br /&gt;
===Teachers able to enrol users via the cohort sync enrolment method===&lt;br /&gt;
&lt;br /&gt;
Teachers will get access to [[Cohort sync]] enrolment method if it is enabled, remove capability to use this enrolment method from teachers if you want to preserve 2.7 behaviour. See MDL-36014&lt;br /&gt;
&lt;br /&gt;
===Gradebook scrolling and theme issues===&lt;br /&gt;
Themes with non-fixed headers must have the .navbar class in their navbar in order for floating headers in the grader report to work - see MDL-46658 for more information.&lt;br /&gt;
&lt;br /&gt;
===Removal of the &#039;Group members only&#039; experimental setting===&lt;br /&gt;
&lt;br /&gt;
The experimental setting &#039;Group members only&#039; has been removed in Moodle 2.8. The group and grouping restrictions in [[Conditional activities settings|conditional activities]] now provide this functionality. Any &#039;Available for group members only&#039; instances are automatically converted to group or grouping restrictions when a site is upgraded.&lt;br /&gt;
&lt;br /&gt;
* &#039;Available for group members only&#039; instances with no grouping selected are converted to a &#039;Must belong to any group&#039; restriction.&lt;br /&gt;
* &#039;Available for group members only&#039; instances with a grouping specified are converted to a &#039;Must belong to the specific grouping&#039; restriction.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;More items to be added here...&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== MySQL dmlwriteexceptionerror exception throw on course restoration ===&lt;br /&gt;
&lt;br /&gt;
Some users are getting the following MySQL error during the course restoration procedure:&lt;br /&gt;
&lt;br /&gt;
  Row size too large (&amp;gt;8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help.&lt;br /&gt;
&lt;br /&gt;
This affect all moodle versions and is due MySQL default InnoDB file format (Antelope) cannot handle more than 10 text columns. We strongly recommend you change the InnoDB file format to Barracuda.&lt;br /&gt;
&lt;br /&gt;
Since 2.6 onwards we have a tool specially to help users on this conversion. Please use the command below to do the database change.&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/mysql_compressed_rows.php&lt;br /&gt;
&lt;br /&gt;
More information about InnoDB file formats can be found here:&lt;br /&gt;
  http://dev.mysql.com/doc/innodb/1.1/en/glossary.html#glos_antelope&lt;br /&gt;
  http://dev.mysql.com/doc/innodb/1.1/en/glossary.html#glos_barracuda&lt;br /&gt;
&lt;br /&gt;
=== Moodle 2.3, 2.4, 2.5, 2.6 and 2.7 improvements ===&lt;br /&gt;
&lt;br /&gt;
Depending on which version you are upgrading from, please see the section &#039;Possible issues that may affect you&#039; in the documentation&lt;br /&gt;
&lt;br /&gt;
* [https://docs.moodle.org/23/en/Upgrading Upgrading to Moodle 2.3]&lt;br /&gt;
* [https://docs.moodle.org/24/en/Upgrading Upgrading to Moodle 2.4]&lt;br /&gt;
* [https://docs.moodle.org/25/en/Upgrading Upgrading to Moodle 2.5]&lt;br /&gt;
* [https://docs.moodle.org/26/en/Upgrading Upgrading to Moodle 2.6]&lt;br /&gt;
* [https://docs.moodle.org/27/en/Upgrading Upgrading to Moodle 2.7]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Installation]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?id=28 Installation problems forum] &lt;br /&gt;
* [[dev:Moodle 2.8 release notes|Moodle 2.8 release notes]]&lt;br /&gt;
&lt;br /&gt;
[[es:Actualización de moodle]]&lt;br /&gt;
[[fr:Mise à jour]]&lt;br /&gt;
[[ja:Moodleをアップグレードする]]&lt;br /&gt;
[[de:Aktualisierung von Moodle]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Administration_via_command_line&amp;diff=116956</id>
		<title>Administration via command line</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Administration_via_command_line&amp;diff=116956"/>
		<updated>2015-02-09T08:11:18Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* Tool for converting innodb tables to Barracuda */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
If you have shell access to your web server, you may find various CLI (command line interface) scripts useful during Moodle administration. Core admin CLI tools are located in the &amp;lt;code&amp;gt;admin/cli/*&amp;lt;/code&amp;gt; folder. Other plugins provide their CLI functionality via scripts in their own cli folder. For example, the enrol_db sync script is located in &amp;lt;code&amp;gt;enrol/db/cli/&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid problems with access control, you should run them as the owner of the web server process. It is especially important for CLI installation and upgrade as they create new files in moodledata directory and the web server has to have write access to them. In Linux distributions, the user that runs the web server is usually apache or wwrun or httpd or something similar. As a root, you will probably want to execute Moodle CLI scripts like this:&lt;br /&gt;
&lt;br /&gt;
    $ cd /path/to/your/moodle/dir&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/somescript.php --params&lt;br /&gt;
&lt;br /&gt;
Most of the scripts accept common --help (or -h) parameter to display the full usage information, for example:&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/install.php --help&lt;br /&gt;
&lt;br /&gt;
== Upgrading via command line ==&lt;br /&gt;
&lt;br /&gt;
Moodle can be upgraded from the command line. As with the installation script, there is either interactive or non-interactive mode of the upgrade. The script itself does not put the site into the maintenance mode, you have to do it on your own. Also, the script does not backup any data (if you read this page, you probably have some own scripts to backup your moodledata and the database, right?)&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/upgrade.php&lt;br /&gt;
&lt;br /&gt;
Upgrading via command line is a very comfortable way of Moodle upgrade if you use Git checkout of the Moodle source code (see [[Git for Administrators]]). See the following procedure how to upgrade your site within several seconds to the most recent version while preserving your eventual local customizations tracked in git repository:&lt;br /&gt;
&lt;br /&gt;
    $ cd /var/www/sites/moodle/htdocs/&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --enable&lt;br /&gt;
    $ git pull&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/upgrade.php&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --disable&lt;br /&gt;
&lt;br /&gt;
== Installation via command line ==&lt;br /&gt;
&lt;br /&gt;
Since version 2.0, Moodle can be installed from the command line. There are two modes of installation. In interactive mode, the install script asks you for all data needed to properly set up new Moodle site. In non-interactive mode, you must provide all required data as the script parameters and then the new site is installed silently. The parameters can be passed in the interactive mode, too. The provided values are then used as the default values during the interactive session.&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/install.php --lang=cs&lt;br /&gt;
&lt;br /&gt;
== Maintenance mode ==&lt;br /&gt;
&lt;br /&gt;
To switch your site into the maintenance mode via CLI, you can use&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --enable&lt;br /&gt;
&lt;br /&gt;
To turn the maintenance mode off, just execute the same script with --disable parameter.&lt;br /&gt;
&lt;br /&gt;
== Offline mode ==&lt;br /&gt;
&lt;br /&gt;
In some situations, you may want to switch your Moodle site into offline mode so that it is not accessible via the web but you can not stop the web server completely (typically because there are other web pages and applications running there). If a file called &amp;lt;code&amp;gt;climaintenance.html&amp;lt;/code&amp;gt; exists in the root folder of moodledata directory, Moodle will automatically display the contents of that file instead of any other page.&lt;br /&gt;
&lt;br /&gt;
    $ cd /var/www/sites/moodle/moodledata/&lt;br /&gt;
    $ echo &#039;&amp;amp;lt;h1&amp;amp;gt;Sorry, maintenance in progress&amp;amp;lt;/h1&amp;amp;gt;&#039; &amp;amp;gt; climaintenance.html&lt;br /&gt;
&lt;br /&gt;
You can prepare a nice formatted HTML page to inform your users about the server being down and keep in the moodledata directory under a name like &amp;lt;code&amp;gt;climaintenance.off&amp;lt;/code&amp;gt; and rename it to the &amp;lt;code&amp;gt;climaintenance.html&amp;lt;/code&amp;gt; if needed.&lt;br /&gt;
&lt;br /&gt;
== Custom site defaults ==&lt;br /&gt;
&lt;br /&gt;
During the install and upgrade via CLI, Moodle sets the administration variables to the default values. You can use different defaults. See MDL-17850 for details. Shortly, all you need to do is to add a file &amp;lt;code&amp;gt;local/defaults.php&amp;lt;/code&amp;gt; into your Moodle installation. The format of the file is like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$defaults[&#039;pluginname&#039;][&#039;settingname&#039;] = &#039;settingvalue&#039;; // for plugins&lt;br /&gt;
$defaults[&#039;moodle&#039;][&#039;settingname&#039;] = &#039;settingvalue&#039;;     // for core settings&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These defaults are used during install, upgrade and are also displayed as defaults at the Site administration pages.&lt;br /&gt;
&lt;br /&gt;
== Reset user password ==&lt;br /&gt;
&lt;br /&gt;
If you happen to forget your admin password (or you want to set a password for any other user of your Moodle system), you can use reset_password.php script. The script sets the correctly salted password for the given user.&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/reset_password.php&lt;br /&gt;
&lt;br /&gt;
== MySQL storage engine conversion ==&lt;br /&gt;
&lt;br /&gt;
If you run your Moodle site with MySQL database backend and use the default MyISAM as the storage engine for your tables, you may want to convert them to use some more reliable engine like InnoDB (actually, you should want to switch to PostgreSQL ;-) anyway).&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/mysql_engine.php --engine=InnoDB&lt;br /&gt;
&lt;br /&gt;
== Running cron via command line ==&lt;br /&gt;
&lt;br /&gt;
In versions 1.x, you could execute admin/cron.php either from command line or via the web. Since Moodle 2.0, only admin/cli/cron.php script can be run via command line.&lt;br /&gt;
&lt;br /&gt;
== Scheduled tasks ==&lt;br /&gt;
&lt;br /&gt;
Since Moodle 2.7&lt;br /&gt;
&lt;br /&gt;
Scheduled tasks are automatically run by the cron script above, but the specific tasks which run on each cron iteration are determined by the scheduled tasks configuration. It is possible to override the scheduled tasks configuration and run a single scheduled task immediately using the admin/tool/task/cli/schedule_task.php script. &lt;br /&gt;
&lt;br /&gt;
This script accepts the following arguments:&lt;br /&gt;
&lt;br /&gt;
 --list - list all the known scheduled tasks. The tasks are listed by the class name used to run the task. This class name is required as the argument to the next option in order to run a specific task immediately.&lt;br /&gt;
&lt;br /&gt;
 --execute=&amp;lt;task&amp;gt; - Runs a single scheduled task immediately - regardless of scheduling settings. This will even run disabled tasks. Tasks will still use locking to prevent concurrent execution of the same task - even on clusters. The format of the &amp;lt;task&amp;gt; argument must be the same as returned by the --list option above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; You must escape the &amp;quot;\&amp;quot; with an extra \ when using the --execute command. Take the following for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;php schedule_task.php --list&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will return something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
== List of scheduled tasks (http://yourserver.com/moodle) ==&lt;br /&gt;
\enrol_imsenterprise\task\cron_task                10 * * * * *      ASAP&lt;br /&gt;
\logstore_legacy\task\cleanup_task                 * 5 * * * *       ASAP&lt;br /&gt;
\logstore_standard\task\cleanup_task               * 4 * * * *       Wednesday, November 12, 2014, 4:35 AM&lt;br /&gt;
\mod_forum\task\cron_task                          * * * * * *       ASAP&lt;br /&gt;
\core\task\automated_backup_task                   50 * * * * *      ASAP&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run the first task in that list, you would execute&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;php schedule_task.php --execute=\\enrol_imsenterprise\\task\\cron_task&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Database transfer==&lt;br /&gt;
&lt;br /&gt;
A command line script for [[Database transfer]] may be found in &#039;&#039;admin/tool/dbtransfer/cli/migrate.php&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Update user pictures via command line==&lt;br /&gt;
&lt;br /&gt;
   http://moodle.org/pluginfile.php/143/mod_forum/attachment/926929/updatepics.php &lt;br /&gt;
Tested for 2.3.1+&lt;br /&gt;
&lt;br /&gt;
Place this file in /admin/cli/updatepics.php&lt;br /&gt;
&lt;br /&gt;
How to use:&lt;br /&gt;
Run with &amp;quot;dir&amp;quot; option to specify which directory contains the files.&lt;br /&gt;
&lt;br /&gt;
   .../admin/cli/updatepics.php --dir=PATH_TO_DIR&lt;br /&gt;
&lt;br /&gt;
* File names must be identical to usernames&lt;br /&gt;
&lt;br /&gt;
==Manage MOD&#039;s,Blocks via command line==&lt;br /&gt;
&lt;br /&gt;
Here are two scripts to help you manage your plugins.&lt;br /&gt;
&lt;br /&gt;
   http://tracker.moodle.org/browse/MDL-35736&lt;br /&gt;
&lt;br /&gt;
How to use &amp;quot;manage_blocks.php&amp;quot;:&lt;br /&gt;
place in /admin/cli&lt;br /&gt;
&lt;br /&gt;
hide:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --hide&lt;br /&gt;
&lt;br /&gt;
show:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --show&lt;br /&gt;
&lt;br /&gt;
delete:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --delete&lt;br /&gt;
&lt;br /&gt;
protect:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --protect&lt;br /&gt;
&lt;br /&gt;
unprotect:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --unprotect&lt;br /&gt;
&lt;br /&gt;
(obviously - replace &amp;quot;tag_youtube&amp;quot; with the blockthat you want to remove...)&lt;br /&gt;
&lt;br /&gt;
How to use &amp;quot;manage_mods.php&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
hide:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --hide&lt;br /&gt;
&lt;br /&gt;
show:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --show&lt;br /&gt;
&lt;br /&gt;
delete:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --delete&lt;br /&gt;
&lt;br /&gt;
*Important!&lt;br /&gt;
this script does not delete the relevant folder in /moodle/mod or /moodle/blocks&lt;br /&gt;
&lt;br /&gt;
you have to delete it yourself !&lt;br /&gt;
&lt;br /&gt;
==Update language pack via CLI==&lt;br /&gt;
&lt;br /&gt;
  http://tracker.moodle.org/browse/MDL-35735&lt;br /&gt;
&lt;br /&gt;
Place attached file in /admin/cli&lt;br /&gt;
and simply run it, without any command-line arguments :)&lt;br /&gt;
&lt;br /&gt;
==ReSort course list via CLI==&lt;br /&gt;
&lt;br /&gt;
  http://tracker.moodle.org/browse/MDL-36237&lt;br /&gt;
&lt;br /&gt;
Place attached file in /admin/cli&lt;br /&gt;
and simply run it, without any command-line arguments :)&lt;br /&gt;
&lt;br /&gt;
I import courses every night from an external system, and run this script afterwards&lt;br /&gt;
&lt;br /&gt;
==Purge caches via CLI==&lt;br /&gt;
&lt;br /&gt;
You can purge caches using this script:&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/purge_caches.php&lt;br /&gt;
&lt;br /&gt;
==Tool for converting innodb tables to Barracuda==&lt;br /&gt;
&lt;br /&gt;
Some users are getting the following MySQL error during the course restoration procedure:&lt;br /&gt;
&lt;br /&gt;
  Row size too large (&amp;gt;8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help.&lt;br /&gt;
&lt;br /&gt;
This affect all moodle versions and is due MySQL default InnoDB file format (Antelope) cannot handle more than 10 text columns. We strongly recommend you change the InnoDB file format to Barracuda.&lt;br /&gt;
&lt;br /&gt;
Since 2.6 onwards we have a tool specially to help users on this conversion. Please use the command below to do the database change.&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/mysql_compressed_rows.php&lt;br /&gt;
&lt;br /&gt;
More information about InnoDB file formats can be found here:&lt;br /&gt;
  http://dev.mysql.com/doc/innodb/1.1/en/glossary.html#glos_antelope&lt;br /&gt;
  http://dev.mysql.com/doc/innodb/1.1/en/glossary.html#glos_barracuda&lt;br /&gt;
&lt;br /&gt;
[[fr:Administration en ligne de commande]]&lt;br /&gt;
[[de:Administration über Kommandozeile]]&lt;br /&gt;
[[ja:コマンドライン経由の管理]]&lt;br /&gt;
[[es:Administración por línea de comando]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Administration_via_command_line&amp;diff=116955</id>
		<title>Administration via command line</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Administration_via_command_line&amp;diff=116955"/>
		<updated>2015-02-09T08:07:34Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* Tool for converting innodb tables to Barracuda */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
If you have shell access to your web server, you may find various CLI (command line interface) scripts useful during Moodle administration. Core admin CLI tools are located in the &amp;lt;code&amp;gt;admin/cli/*&amp;lt;/code&amp;gt; folder. Other plugins provide their CLI functionality via scripts in their own cli folder. For example, the enrol_db sync script is located in &amp;lt;code&amp;gt;enrol/db/cli/&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid problems with access control, you should run them as the owner of the web server process. It is especially important for CLI installation and upgrade as they create new files in moodledata directory and the web server has to have write access to them. In Linux distributions, the user that runs the web server is usually apache or wwrun or httpd or something similar. As a root, you will probably want to execute Moodle CLI scripts like this:&lt;br /&gt;
&lt;br /&gt;
    $ cd /path/to/your/moodle/dir&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/somescript.php --params&lt;br /&gt;
&lt;br /&gt;
Most of the scripts accept common --help (or -h) parameter to display the full usage information, for example:&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/install.php --help&lt;br /&gt;
&lt;br /&gt;
== Upgrading via command line ==&lt;br /&gt;
&lt;br /&gt;
Moodle can be upgraded from the command line. As with the installation script, there is either interactive or non-interactive mode of the upgrade. The script itself does not put the site into the maintenance mode, you have to do it on your own. Also, the script does not backup any data (if you read this page, you probably have some own scripts to backup your moodledata and the database, right?)&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/upgrade.php&lt;br /&gt;
&lt;br /&gt;
Upgrading via command line is a very comfortable way of Moodle upgrade if you use Git checkout of the Moodle source code (see [[Git for Administrators]]). See the following procedure how to upgrade your site within several seconds to the most recent version while preserving your eventual local customizations tracked in git repository:&lt;br /&gt;
&lt;br /&gt;
    $ cd /var/www/sites/moodle/htdocs/&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --enable&lt;br /&gt;
    $ git pull&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/upgrade.php&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --disable&lt;br /&gt;
&lt;br /&gt;
== Installation via command line ==&lt;br /&gt;
&lt;br /&gt;
Since version 2.0, Moodle can be installed from the command line. There are two modes of installation. In interactive mode, the install script asks you for all data needed to properly set up new Moodle site. In non-interactive mode, you must provide all required data as the script parameters and then the new site is installed silently. The parameters can be passed in the interactive mode, too. The provided values are then used as the default values during the interactive session.&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/install.php --lang=cs&lt;br /&gt;
&lt;br /&gt;
== Maintenance mode ==&lt;br /&gt;
&lt;br /&gt;
To switch your site into the maintenance mode via CLI, you can use&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --enable&lt;br /&gt;
&lt;br /&gt;
To turn the maintenance mode off, just execute the same script with --disable parameter.&lt;br /&gt;
&lt;br /&gt;
== Offline mode ==&lt;br /&gt;
&lt;br /&gt;
In some situations, you may want to switch your Moodle site into offline mode so that it is not accessible via the web but you can not stop the web server completely (typically because there are other web pages and applications running there). If a file called &amp;lt;code&amp;gt;climaintenance.html&amp;lt;/code&amp;gt; exists in the root folder of moodledata directory, Moodle will automatically display the contents of that file instead of any other page.&lt;br /&gt;
&lt;br /&gt;
    $ cd /var/www/sites/moodle/moodledata/&lt;br /&gt;
    $ echo &#039;&amp;amp;lt;h1&amp;amp;gt;Sorry, maintenance in progress&amp;amp;lt;/h1&amp;amp;gt;&#039; &amp;amp;gt; climaintenance.html&lt;br /&gt;
&lt;br /&gt;
You can prepare a nice formatted HTML page to inform your users about the server being down and keep in the moodledata directory under a name like &amp;lt;code&amp;gt;climaintenance.off&amp;lt;/code&amp;gt; and rename it to the &amp;lt;code&amp;gt;climaintenance.html&amp;lt;/code&amp;gt; if needed.&lt;br /&gt;
&lt;br /&gt;
== Custom site defaults ==&lt;br /&gt;
&lt;br /&gt;
During the install and upgrade via CLI, Moodle sets the administration variables to the default values. You can use different defaults. See MDL-17850 for details. Shortly, all you need to do is to add a file &amp;lt;code&amp;gt;local/defaults.php&amp;lt;/code&amp;gt; into your Moodle installation. The format of the file is like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$defaults[&#039;pluginname&#039;][&#039;settingname&#039;] = &#039;settingvalue&#039;; // for plugins&lt;br /&gt;
$defaults[&#039;moodle&#039;][&#039;settingname&#039;] = &#039;settingvalue&#039;;     // for core settings&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These defaults are used during install, upgrade and are also displayed as defaults at the Site administration pages.&lt;br /&gt;
&lt;br /&gt;
== Reset user password ==&lt;br /&gt;
&lt;br /&gt;
If you happen to forget your admin password (or you want to set a password for any other user of your Moodle system), you can use reset_password.php script. The script sets the correctly salted password for the given user.&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/reset_password.php&lt;br /&gt;
&lt;br /&gt;
== MySQL storage engine conversion ==&lt;br /&gt;
&lt;br /&gt;
If you run your Moodle site with MySQL database backend and use the default MyISAM as the storage engine for your tables, you may want to convert them to use some more reliable engine like InnoDB (actually, you should want to switch to PostgreSQL ;-) anyway).&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/mysql_engine.php --engine=InnoDB&lt;br /&gt;
&lt;br /&gt;
== Running cron via command line ==&lt;br /&gt;
&lt;br /&gt;
In versions 1.x, you could execute admin/cron.php either from command line or via the web. Since Moodle 2.0, only admin/cli/cron.php script can be run via command line.&lt;br /&gt;
&lt;br /&gt;
== Scheduled tasks ==&lt;br /&gt;
&lt;br /&gt;
Since Moodle 2.7&lt;br /&gt;
&lt;br /&gt;
Scheduled tasks are automatically run by the cron script above, but the specific tasks which run on each cron iteration are determined by the scheduled tasks configuration. It is possible to override the scheduled tasks configuration and run a single scheduled task immediately using the admin/tool/task/cli/schedule_task.php script. &lt;br /&gt;
&lt;br /&gt;
This script accepts the following arguments:&lt;br /&gt;
&lt;br /&gt;
 --list - list all the known scheduled tasks. The tasks are listed by the class name used to run the task. This class name is required as the argument to the next option in order to run a specific task immediately.&lt;br /&gt;
&lt;br /&gt;
 --execute=&amp;lt;task&amp;gt; - Runs a single scheduled task immediately - regardless of scheduling settings. This will even run disabled tasks. Tasks will still use locking to prevent concurrent execution of the same task - even on clusters. The format of the &amp;lt;task&amp;gt; argument must be the same as returned by the --list option above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; You must escape the &amp;quot;\&amp;quot; with an extra \ when using the --execute command. Take the following for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;php schedule_task.php --list&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will return something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
== List of scheduled tasks (http://yourserver.com/moodle) ==&lt;br /&gt;
\enrol_imsenterprise\task\cron_task                10 * * * * *      ASAP&lt;br /&gt;
\logstore_legacy\task\cleanup_task                 * 5 * * * *       ASAP&lt;br /&gt;
\logstore_standard\task\cleanup_task               * 4 * * * *       Wednesday, November 12, 2014, 4:35 AM&lt;br /&gt;
\mod_forum\task\cron_task                          * * * * * *       ASAP&lt;br /&gt;
\core\task\automated_backup_task                   50 * * * * *      ASAP&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run the first task in that list, you would execute&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;php schedule_task.php --execute=\\enrol_imsenterprise\\task\\cron_task&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Database transfer==&lt;br /&gt;
&lt;br /&gt;
A command line script for [[Database transfer]] may be found in &#039;&#039;admin/tool/dbtransfer/cli/migrate.php&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Update user pictures via command line==&lt;br /&gt;
&lt;br /&gt;
   http://moodle.org/pluginfile.php/143/mod_forum/attachment/926929/updatepics.php &lt;br /&gt;
Tested for 2.3.1+&lt;br /&gt;
&lt;br /&gt;
Place this file in /admin/cli/updatepics.php&lt;br /&gt;
&lt;br /&gt;
How to use:&lt;br /&gt;
Run with &amp;quot;dir&amp;quot; option to specify which directory contains the files.&lt;br /&gt;
&lt;br /&gt;
   .../admin/cli/updatepics.php --dir=PATH_TO_DIR&lt;br /&gt;
&lt;br /&gt;
* File names must be identical to usernames&lt;br /&gt;
&lt;br /&gt;
==Manage MOD&#039;s,Blocks via command line==&lt;br /&gt;
&lt;br /&gt;
Here are two scripts to help you manage your plugins.&lt;br /&gt;
&lt;br /&gt;
   http://tracker.moodle.org/browse/MDL-35736&lt;br /&gt;
&lt;br /&gt;
How to use &amp;quot;manage_blocks.php&amp;quot;:&lt;br /&gt;
place in /admin/cli&lt;br /&gt;
&lt;br /&gt;
hide:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --hide&lt;br /&gt;
&lt;br /&gt;
show:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --show&lt;br /&gt;
&lt;br /&gt;
delete:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --delete&lt;br /&gt;
&lt;br /&gt;
protect:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --protect&lt;br /&gt;
&lt;br /&gt;
unprotect:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --unprotect&lt;br /&gt;
&lt;br /&gt;
(obviously - replace &amp;quot;tag_youtube&amp;quot; with the blockthat you want to remove...)&lt;br /&gt;
&lt;br /&gt;
How to use &amp;quot;manage_mods.php&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
hide:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --hide&lt;br /&gt;
&lt;br /&gt;
show:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --show&lt;br /&gt;
&lt;br /&gt;
delete:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --delete&lt;br /&gt;
&lt;br /&gt;
*Important!&lt;br /&gt;
this script does not delete the relevant folder in /moodle/mod or /moodle/blocks&lt;br /&gt;
&lt;br /&gt;
you have to delete it yourself !&lt;br /&gt;
&lt;br /&gt;
==Update language pack via CLI==&lt;br /&gt;
&lt;br /&gt;
  http://tracker.moodle.org/browse/MDL-35735&lt;br /&gt;
&lt;br /&gt;
Place attached file in /admin/cli&lt;br /&gt;
and simply run it, without any command-line arguments :)&lt;br /&gt;
&lt;br /&gt;
==ReSort course list via CLI==&lt;br /&gt;
&lt;br /&gt;
  http://tracker.moodle.org/browse/MDL-36237&lt;br /&gt;
&lt;br /&gt;
Place attached file in /admin/cli&lt;br /&gt;
and simply run it, without any command-line arguments :)&lt;br /&gt;
&lt;br /&gt;
I import courses every night from an external system, and run this script afterwards&lt;br /&gt;
&lt;br /&gt;
==Purge caches via CLI==&lt;br /&gt;
&lt;br /&gt;
You can purge caches using this script:&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/purge_caches.php&lt;br /&gt;
&lt;br /&gt;
==Tool for converting innodb tables to Barracuda==&lt;br /&gt;
&lt;br /&gt;
Some users are getting the following MySQL error during the course restoration procedure:&lt;br /&gt;
&lt;br /&gt;
  Row size too large (&amp;gt;8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help.&lt;br /&gt;
&lt;br /&gt;
This is due MySQL default InnoDB file format (Antelope) cannot handle more than 10 text columns. We strongly recommend you change the InnoDB file format to Barracuda.&lt;br /&gt;
&lt;br /&gt;
We&#039;ve created a tool specially to help users on this conversion. Please use the command below to do the database change.&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/mysql_compressed_rows.php&lt;br /&gt;
&lt;br /&gt;
More information about InnoDB file formats can be found here:&lt;br /&gt;
  http://dev.mysql.com/doc/innodb/1.1/en/glossary.html#glos_antelope&lt;br /&gt;
  http://dev.mysql.com/doc/innodb/1.1/en/glossary.html#glos_barracuda&lt;br /&gt;
&lt;br /&gt;
[[fr:Administration en ligne de commande]]&lt;br /&gt;
[[de:Administration über Kommandozeile]]&lt;br /&gt;
[[ja:コマンドライン経由の管理]]&lt;br /&gt;
[[es:Administración por línea de comando]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Administration_via_command_line&amp;diff=116954</id>
		<title>Administration via command line</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Administration_via_command_line&amp;diff=116954"/>
		<updated>2015-02-09T08:04:50Z</updated>

		<summary type="html">&lt;p&gt;Lameze: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
If you have shell access to your web server, you may find various CLI (command line interface) scripts useful during Moodle administration. Core admin CLI tools are located in the &amp;lt;code&amp;gt;admin/cli/*&amp;lt;/code&amp;gt; folder. Other plugins provide their CLI functionality via scripts in their own cli folder. For example, the enrol_db sync script is located in &amp;lt;code&amp;gt;enrol/db/cli/&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid problems with access control, you should run them as the owner of the web server process. It is especially important for CLI installation and upgrade as they create new files in moodledata directory and the web server has to have write access to them. In Linux distributions, the user that runs the web server is usually apache or wwrun or httpd or something similar. As a root, you will probably want to execute Moodle CLI scripts like this:&lt;br /&gt;
&lt;br /&gt;
    $ cd /path/to/your/moodle/dir&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/somescript.php --params&lt;br /&gt;
&lt;br /&gt;
Most of the scripts accept common --help (or -h) parameter to display the full usage information, for example:&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/install.php --help&lt;br /&gt;
&lt;br /&gt;
== Upgrading via command line ==&lt;br /&gt;
&lt;br /&gt;
Moodle can be upgraded from the command line. As with the installation script, there is either interactive or non-interactive mode of the upgrade. The script itself does not put the site into the maintenance mode, you have to do it on your own. Also, the script does not backup any data (if you read this page, you probably have some own scripts to backup your moodledata and the database, right?)&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/upgrade.php&lt;br /&gt;
&lt;br /&gt;
Upgrading via command line is a very comfortable way of Moodle upgrade if you use Git checkout of the Moodle source code (see [[Git for Administrators]]). See the following procedure how to upgrade your site within several seconds to the most recent version while preserving your eventual local customizations tracked in git repository:&lt;br /&gt;
&lt;br /&gt;
    $ cd /var/www/sites/moodle/htdocs/&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --enable&lt;br /&gt;
    $ git pull&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/upgrade.php&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --disable&lt;br /&gt;
&lt;br /&gt;
== Installation via command line ==&lt;br /&gt;
&lt;br /&gt;
Since version 2.0, Moodle can be installed from the command line. There are two modes of installation. In interactive mode, the install script asks you for all data needed to properly set up new Moodle site. In non-interactive mode, you must provide all required data as the script parameters and then the new site is installed silently. The parameters can be passed in the interactive mode, too. The provided values are then used as the default values during the interactive session.&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/install.php --lang=cs&lt;br /&gt;
&lt;br /&gt;
== Maintenance mode ==&lt;br /&gt;
&lt;br /&gt;
To switch your site into the maintenance mode via CLI, you can use&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --enable&lt;br /&gt;
&lt;br /&gt;
To turn the maintenance mode off, just execute the same script with --disable parameter.&lt;br /&gt;
&lt;br /&gt;
== Offline mode ==&lt;br /&gt;
&lt;br /&gt;
In some situations, you may want to switch your Moodle site into offline mode so that it is not accessible via the web but you can not stop the web server completely (typically because there are other web pages and applications running there). If a file called &amp;lt;code&amp;gt;climaintenance.html&amp;lt;/code&amp;gt; exists in the root folder of moodledata directory, Moodle will automatically display the contents of that file instead of any other page.&lt;br /&gt;
&lt;br /&gt;
    $ cd /var/www/sites/moodle/moodledata/&lt;br /&gt;
    $ echo &#039;&amp;amp;lt;h1&amp;amp;gt;Sorry, maintenance in progress&amp;amp;lt;/h1&amp;amp;gt;&#039; &amp;amp;gt; climaintenance.html&lt;br /&gt;
&lt;br /&gt;
You can prepare a nice formatted HTML page to inform your users about the server being down and keep in the moodledata directory under a name like &amp;lt;code&amp;gt;climaintenance.off&amp;lt;/code&amp;gt; and rename it to the &amp;lt;code&amp;gt;climaintenance.html&amp;lt;/code&amp;gt; if needed.&lt;br /&gt;
&lt;br /&gt;
== Custom site defaults ==&lt;br /&gt;
&lt;br /&gt;
During the install and upgrade via CLI, Moodle sets the administration variables to the default values. You can use different defaults. See MDL-17850 for details. Shortly, all you need to do is to add a file &amp;lt;code&amp;gt;local/defaults.php&amp;lt;/code&amp;gt; into your Moodle installation. The format of the file is like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$defaults[&#039;pluginname&#039;][&#039;settingname&#039;] = &#039;settingvalue&#039;; // for plugins&lt;br /&gt;
$defaults[&#039;moodle&#039;][&#039;settingname&#039;] = &#039;settingvalue&#039;;     // for core settings&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These defaults are used during install, upgrade and are also displayed as defaults at the Site administration pages.&lt;br /&gt;
&lt;br /&gt;
== Reset user password ==&lt;br /&gt;
&lt;br /&gt;
If you happen to forget your admin password (or you want to set a password for any other user of your Moodle system), you can use reset_password.php script. The script sets the correctly salted password for the given user.&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/reset_password.php&lt;br /&gt;
&lt;br /&gt;
== MySQL storage engine conversion ==&lt;br /&gt;
&lt;br /&gt;
If you run your Moodle site with MySQL database backend and use the default MyISAM as the storage engine for your tables, you may want to convert them to use some more reliable engine like InnoDB (actually, you should want to switch to PostgreSQL ;-) anyway).&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/mysql_engine.php --engine=InnoDB&lt;br /&gt;
&lt;br /&gt;
== Running cron via command line ==&lt;br /&gt;
&lt;br /&gt;
In versions 1.x, you could execute admin/cron.php either from command line or via the web. Since Moodle 2.0, only admin/cli/cron.php script can be run via command line.&lt;br /&gt;
&lt;br /&gt;
== Scheduled tasks ==&lt;br /&gt;
&lt;br /&gt;
Since Moodle 2.7&lt;br /&gt;
&lt;br /&gt;
Scheduled tasks are automatically run by the cron script above, but the specific tasks which run on each cron iteration are determined by the scheduled tasks configuration. It is possible to override the scheduled tasks configuration and run a single scheduled task immediately using the admin/tool/task/cli/schedule_task.php script. &lt;br /&gt;
&lt;br /&gt;
This script accepts the following arguments:&lt;br /&gt;
&lt;br /&gt;
 --list - list all the known scheduled tasks. The tasks are listed by the class name used to run the task. This class name is required as the argument to the next option in order to run a specific task immediately.&lt;br /&gt;
&lt;br /&gt;
 --execute=&amp;lt;task&amp;gt; - Runs a single scheduled task immediately - regardless of scheduling settings. This will even run disabled tasks. Tasks will still use locking to prevent concurrent execution of the same task - even on clusters. The format of the &amp;lt;task&amp;gt; argument must be the same as returned by the --list option above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; You must escape the &amp;quot;\&amp;quot; with an extra \ when using the --execute command. Take the following for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;php schedule_task.php --list&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will return something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
== List of scheduled tasks (http://yourserver.com/moodle) ==&lt;br /&gt;
\enrol_imsenterprise\task\cron_task                10 * * * * *      ASAP&lt;br /&gt;
\logstore_legacy\task\cleanup_task                 * 5 * * * *       ASAP&lt;br /&gt;
\logstore_standard\task\cleanup_task               * 4 * * * *       Wednesday, November 12, 2014, 4:35 AM&lt;br /&gt;
\mod_forum\task\cron_task                          * * * * * *       ASAP&lt;br /&gt;
\core\task\automated_backup_task                   50 * * * * *      ASAP&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run the first task in that list, you would execute&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;php schedule_task.php --execute=\\enrol_imsenterprise\\task\\cron_task&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Database transfer==&lt;br /&gt;
&lt;br /&gt;
A command line script for [[Database transfer]] may be found in &#039;&#039;admin/tool/dbtransfer/cli/migrate.php&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Update user pictures via command line==&lt;br /&gt;
&lt;br /&gt;
   http://moodle.org/pluginfile.php/143/mod_forum/attachment/926929/updatepics.php &lt;br /&gt;
Tested for 2.3.1+&lt;br /&gt;
&lt;br /&gt;
Place this file in /admin/cli/updatepics.php&lt;br /&gt;
&lt;br /&gt;
How to use:&lt;br /&gt;
Run with &amp;quot;dir&amp;quot; option to specify which directory contains the files.&lt;br /&gt;
&lt;br /&gt;
   .../admin/cli/updatepics.php --dir=PATH_TO_DIR&lt;br /&gt;
&lt;br /&gt;
* File names must be identical to usernames&lt;br /&gt;
&lt;br /&gt;
==Manage MOD&#039;s,Blocks via command line==&lt;br /&gt;
&lt;br /&gt;
Here are two scripts to help you manage your plugins.&lt;br /&gt;
&lt;br /&gt;
   http://tracker.moodle.org/browse/MDL-35736&lt;br /&gt;
&lt;br /&gt;
How to use &amp;quot;manage_blocks.php&amp;quot;:&lt;br /&gt;
place in /admin/cli&lt;br /&gt;
&lt;br /&gt;
hide:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --hide&lt;br /&gt;
&lt;br /&gt;
show:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --show&lt;br /&gt;
&lt;br /&gt;
delete:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --delete&lt;br /&gt;
&lt;br /&gt;
protect:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --protect&lt;br /&gt;
&lt;br /&gt;
unprotect:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --unprotect&lt;br /&gt;
&lt;br /&gt;
(obviously - replace &amp;quot;tag_youtube&amp;quot; with the blockthat you want to remove...)&lt;br /&gt;
&lt;br /&gt;
How to use &amp;quot;manage_mods.php&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
hide:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --hide&lt;br /&gt;
&lt;br /&gt;
show:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --show&lt;br /&gt;
&lt;br /&gt;
delete:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --delete&lt;br /&gt;
&lt;br /&gt;
*Important!&lt;br /&gt;
this script does not delete the relevant folder in /moodle/mod or /moodle/blocks&lt;br /&gt;
&lt;br /&gt;
you have to delete it yourself !&lt;br /&gt;
&lt;br /&gt;
==Update language pack via CLI==&lt;br /&gt;
&lt;br /&gt;
  http://tracker.moodle.org/browse/MDL-35735&lt;br /&gt;
&lt;br /&gt;
Place attached file in /admin/cli&lt;br /&gt;
and simply run it, without any command-line arguments :)&lt;br /&gt;
&lt;br /&gt;
==ReSort course list via CLI==&lt;br /&gt;
&lt;br /&gt;
  http://tracker.moodle.org/browse/MDL-36237&lt;br /&gt;
&lt;br /&gt;
Place attached file in /admin/cli&lt;br /&gt;
and simply run it, without any command-line arguments :)&lt;br /&gt;
&lt;br /&gt;
I import courses every night from an external system, and run this script afterwards&lt;br /&gt;
&lt;br /&gt;
==Purge caches via CLI==&lt;br /&gt;
&lt;br /&gt;
You can purge caches using this script:&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/purge_caches.php&lt;br /&gt;
&lt;br /&gt;
==Tool for converting innodb tables to Barracuda==&lt;br /&gt;
&lt;br /&gt;
Some users upgrading to 2.8 are getting the following MySQL error during the course restoration procedure:&lt;br /&gt;
&lt;br /&gt;
  Row size too large (&amp;gt;8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help.&lt;br /&gt;
&lt;br /&gt;
This is due MySQL default type (Antelope) cannot handle more than 10 text columns. We strongly recommend you change the default type to Barracuda.&lt;br /&gt;
&lt;br /&gt;
We&#039;ve created a tool specially to help users on this database type conversion. Please use the command below to do the database change.&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/mysql_compressed_rows.php&lt;br /&gt;
&lt;br /&gt;
More information about InnoDB file formats can be found here:&lt;br /&gt;
  http://dev.mysql.com/doc/innodb/1.1/en/glossary.html#glos_antelope&lt;br /&gt;
  http://dev.mysql.com/doc/innodb/1.1/en/glossary.html#glos_barracuda&lt;br /&gt;
&lt;br /&gt;
[[fr:Administration en ligne de commande]]&lt;br /&gt;
[[de:Administration über Kommandozeile]]&lt;br /&gt;
[[ja:コマンドライン経由の管理]]&lt;br /&gt;
[[es:Administración por línea de comando]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Administration_via_command_line&amp;diff=116953</id>
		<title>Administration via command line</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Administration_via_command_line&amp;diff=116953"/>
		<updated>2015-02-09T07:41:31Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* Tool for converting innodb tables to Barracuda */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
If you have shell access to your web server, you may find various CLI (command line interface) scripts useful during Moodle administration. Core admin CLI tools are located in the &amp;lt;code&amp;gt;admin/cli/*&amp;lt;/code&amp;gt; folder. Other plugins provide their CLI functionality via scripts in their own cli folder. For example, the enrol_db sync script is located in &amp;lt;code&amp;gt;enrol/db/cli/&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid problems with access control, you should run them as the owner of the web server process. It is especially important for CLI installation and upgrade as they create new files in moodledata directory and the web server has to have write access to them. In Linux distributions, the user that runs the web server is usually apache or wwrun or httpd or something similar. As a root, you will probably want to execute Moodle CLI scripts like this:&lt;br /&gt;
&lt;br /&gt;
    $ cd /path/to/your/moodle/dir&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/somescript.php --params&lt;br /&gt;
&lt;br /&gt;
Most of the scripts accept common --help (or -h) parameter to display the full usage information, for example:&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/install.php --help&lt;br /&gt;
&lt;br /&gt;
== Upgrading via command line ==&lt;br /&gt;
&lt;br /&gt;
Moodle can be upgraded from the command line. As with the installation script, there is either interactive or non-interactive mode of the upgrade. The script itself does not put the site into the maintenance mode, you have to do it on your own. Also, the script does not backup any data (if you read this page, you probably have some own scripts to backup your moodledata and the database, right?)&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/upgrade.php&lt;br /&gt;
&lt;br /&gt;
Upgrading via command line is a very comfortable way of Moodle upgrade if you use Git checkout of the Moodle source code (see [[Git for Administrators]]). See the following procedure how to upgrade your site within several seconds to the most recent version while preserving your eventual local customizations tracked in git repository:&lt;br /&gt;
&lt;br /&gt;
    $ cd /var/www/sites/moodle/htdocs/&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --enable&lt;br /&gt;
    $ git pull&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/upgrade.php&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --disable&lt;br /&gt;
&lt;br /&gt;
== Installation via command line ==&lt;br /&gt;
&lt;br /&gt;
Since version 2.0, Moodle can be installed from the command line. There are two modes of installation. In interactive mode, the install script asks you for all data needed to properly set up new Moodle site. In non-interactive mode, you must provide all required data as the script parameters and then the new site is installed silently. The parameters can be passed in the interactive mode, too. The provided values are then used as the default values during the interactive session.&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/install.php --lang=cs&lt;br /&gt;
&lt;br /&gt;
== Maintenance mode ==&lt;br /&gt;
&lt;br /&gt;
To switch your site into the maintenance mode via CLI, you can use&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --enable&lt;br /&gt;
&lt;br /&gt;
To turn the maintenance mode off, just execute the same script with --disable parameter.&lt;br /&gt;
&lt;br /&gt;
== Offline mode ==&lt;br /&gt;
&lt;br /&gt;
In some situations, you may want to switch your Moodle site into offline mode so that it is not accessible via the web but you can not stop the web server completely (typically because there are other web pages and applications running there). If a file called &amp;lt;code&amp;gt;climaintenance.html&amp;lt;/code&amp;gt; exists in the root folder of moodledata directory, Moodle will automatically display the contents of that file instead of any other page.&lt;br /&gt;
&lt;br /&gt;
    $ cd /var/www/sites/moodle/moodledata/&lt;br /&gt;
    $ echo &#039;&amp;amp;lt;h1&amp;amp;gt;Sorry, maintenance in progress&amp;amp;lt;/h1&amp;amp;gt;&#039; &amp;amp;gt; climaintenance.html&lt;br /&gt;
&lt;br /&gt;
You can prepare a nice formatted HTML page to inform your users about the server being down and keep in the moodledata directory under a name like &amp;lt;code&amp;gt;climaintenance.off&amp;lt;/code&amp;gt; and rename it to the &amp;lt;code&amp;gt;climaintenance.html&amp;lt;/code&amp;gt; if needed.&lt;br /&gt;
&lt;br /&gt;
== Custom site defaults ==&lt;br /&gt;
&lt;br /&gt;
During the install and upgrade via CLI, Moodle sets the administration variables to the default values. You can use different defaults. See MDL-17850 for details. Shortly, all you need to do is to add a file &amp;lt;code&amp;gt;local/defaults.php&amp;lt;/code&amp;gt; into your Moodle installation. The format of the file is like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$defaults[&#039;pluginname&#039;][&#039;settingname&#039;] = &#039;settingvalue&#039;; // for plugins&lt;br /&gt;
$defaults[&#039;moodle&#039;][&#039;settingname&#039;] = &#039;settingvalue&#039;;     // for core settings&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These defaults are used during install, upgrade and are also displayed as defaults at the Site administration pages.&lt;br /&gt;
&lt;br /&gt;
== Reset user password ==&lt;br /&gt;
&lt;br /&gt;
If you happen to forget your admin password (or you want to set a password for any other user of your Moodle system), you can use reset_password.php script. The script sets the correctly salted password for the given user.&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/reset_password.php&lt;br /&gt;
&lt;br /&gt;
== MySQL storage engine conversion ==&lt;br /&gt;
&lt;br /&gt;
If you run your Moodle site with MySQL database backend and use the default MyISAM as the storage engine for your tables, you may want to convert them to use some more reliable engine like InnoDB (actually, you should want to switch to PostgreSQL ;-) anyway).&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/mysql_engine.php --engine=InnoDB&lt;br /&gt;
&lt;br /&gt;
== Running cron via command line ==&lt;br /&gt;
&lt;br /&gt;
In versions 1.x, you could execute admin/cron.php either from command line or via the web. Since Moodle 2.0, only admin/cli/cron.php script can be run via command line.&lt;br /&gt;
&lt;br /&gt;
== Scheduled tasks ==&lt;br /&gt;
&lt;br /&gt;
Since Moodle 2.7&lt;br /&gt;
&lt;br /&gt;
Scheduled tasks are automatically run by the cron script above, but the specific tasks which run on each cron iteration are determined by the scheduled tasks configuration. It is possible to override the scheduled tasks configuration and run a single scheduled task immediately using the admin/tool/task/cli/schedule_task.php script. &lt;br /&gt;
&lt;br /&gt;
This script accepts the following arguments:&lt;br /&gt;
&lt;br /&gt;
 --list - list all the known scheduled tasks. The tasks are listed by the class name used to run the task. This class name is required as the argument to the next option in order to run a specific task immediately.&lt;br /&gt;
&lt;br /&gt;
 --execute=&amp;lt;task&amp;gt; - Runs a single scheduled task immediately - regardless of scheduling settings. This will even run disabled tasks. Tasks will still use locking to prevent concurrent execution of the same task - even on clusters. The format of the &amp;lt;task&amp;gt; argument must be the same as returned by the --list option above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; You must escape the &amp;quot;\&amp;quot; with an extra \ when using the --execute command. Take the following for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;php schedule_task.php --list&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will return something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
== List of scheduled tasks (http://yourserver.com/moodle) ==&lt;br /&gt;
\enrol_imsenterprise\task\cron_task                10 * * * * *      ASAP&lt;br /&gt;
\logstore_legacy\task\cleanup_task                 * 5 * * * *       ASAP&lt;br /&gt;
\logstore_standard\task\cleanup_task               * 4 * * * *       Wednesday, November 12, 2014, 4:35 AM&lt;br /&gt;
\mod_forum\task\cron_task                          * * * * * *       ASAP&lt;br /&gt;
\core\task\automated_backup_task                   50 * * * * *      ASAP&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run the first task in that list, you would execute&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;php schedule_task.php --execute=\\enrol_imsenterprise\\task\\cron_task&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Database transfer==&lt;br /&gt;
&lt;br /&gt;
A command line script for [[Database transfer]] may be found in &#039;&#039;admin/tool/dbtransfer/cli/migrate.php&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Update user pictures via command line==&lt;br /&gt;
&lt;br /&gt;
   http://moodle.org/pluginfile.php/143/mod_forum/attachment/926929/updatepics.php &lt;br /&gt;
Tested for 2.3.1+&lt;br /&gt;
&lt;br /&gt;
Place this file in /admin/cli/updatepics.php&lt;br /&gt;
&lt;br /&gt;
How to use:&lt;br /&gt;
Run with &amp;quot;dir&amp;quot; option to specify which directory contains the files.&lt;br /&gt;
&lt;br /&gt;
   .../admin/cli/updatepics.php --dir=PATH_TO_DIR&lt;br /&gt;
&lt;br /&gt;
* File names must be identical to usernames&lt;br /&gt;
&lt;br /&gt;
==Manage MOD&#039;s,Blocks via command line==&lt;br /&gt;
&lt;br /&gt;
Here are two scripts to help you manage your plugins.&lt;br /&gt;
&lt;br /&gt;
   http://tracker.moodle.org/browse/MDL-35736&lt;br /&gt;
&lt;br /&gt;
How to use &amp;quot;manage_blocks.php&amp;quot;:&lt;br /&gt;
place in /admin/cli&lt;br /&gt;
&lt;br /&gt;
hide:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --hide&lt;br /&gt;
&lt;br /&gt;
show:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --show&lt;br /&gt;
&lt;br /&gt;
delete:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --delete&lt;br /&gt;
&lt;br /&gt;
protect:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --protect&lt;br /&gt;
&lt;br /&gt;
unprotect:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --unprotect&lt;br /&gt;
&lt;br /&gt;
(obviously - replace &amp;quot;tag_youtube&amp;quot; with the blockthat you want to remove...)&lt;br /&gt;
&lt;br /&gt;
How to use &amp;quot;manage_mods.php&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
hide:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --hide&lt;br /&gt;
&lt;br /&gt;
show:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --show&lt;br /&gt;
&lt;br /&gt;
delete:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --delete&lt;br /&gt;
&lt;br /&gt;
*Important!&lt;br /&gt;
this script does not delete the relevant folder in /moodle/mod or /moodle/blocks&lt;br /&gt;
&lt;br /&gt;
you have to delete it yourself !&lt;br /&gt;
&lt;br /&gt;
==Update language pack via CLI==&lt;br /&gt;
&lt;br /&gt;
  http://tracker.moodle.org/browse/MDL-35735&lt;br /&gt;
&lt;br /&gt;
Place attached file in /admin/cli&lt;br /&gt;
and simply run it, without any command-line arguments :)&lt;br /&gt;
&lt;br /&gt;
==ReSort course list via CLI==&lt;br /&gt;
&lt;br /&gt;
  http://tracker.moodle.org/browse/MDL-36237&lt;br /&gt;
&lt;br /&gt;
Place attached file in /admin/cli&lt;br /&gt;
and simply run it, without any command-line arguments :)&lt;br /&gt;
&lt;br /&gt;
I import courses every night from an external system, and run this script afterwards&lt;br /&gt;
&lt;br /&gt;
==Purge caches via CLI==&lt;br /&gt;
&lt;br /&gt;
You can purge caches using this script:&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/purge_caches.php&lt;br /&gt;
&lt;br /&gt;
==Tool for converting innodb tables to Barracuda==&lt;br /&gt;
&lt;br /&gt;
Some users upgrading to 2.8 are getting the following MySQL error during the course restoration procedure:&lt;br /&gt;
&lt;br /&gt;
  Row size too large (&amp;gt;8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help.&lt;br /&gt;
&lt;br /&gt;
This is due MySQL default type (Antelope) cannot handle more than 10 text columns. We strongly recommend you change the default type to Barracuda.&lt;br /&gt;
&lt;br /&gt;
We&#039;ve created a tool specially to help users on this database type conversion. Please use the command below to do the database change.&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/mysql_compressed_rows.php&lt;br /&gt;
&lt;br /&gt;
[[fr:Administration en ligne de commande]]&lt;br /&gt;
[[de:Administration über Kommandozeile]]&lt;br /&gt;
[[ja:コマンドライン経由の管理]]&lt;br /&gt;
[[es:Administración por línea de comando]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Administration_via_command_line&amp;diff=116952</id>
		<title>Administration via command line</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Administration_via_command_line&amp;diff=116952"/>
		<updated>2015-02-09T07:40:44Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* Tool for converting innodb tables to Barracuda */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
If you have shell access to your web server, you may find various CLI (command line interface) scripts useful during Moodle administration. Core admin CLI tools are located in the &amp;lt;code&amp;gt;admin/cli/*&amp;lt;/code&amp;gt; folder. Other plugins provide their CLI functionality via scripts in their own cli folder. For example, the enrol_db sync script is located in &amp;lt;code&amp;gt;enrol/db/cli/&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid problems with access control, you should run them as the owner of the web server process. It is especially important for CLI installation and upgrade as they create new files in moodledata directory and the web server has to have write access to them. In Linux distributions, the user that runs the web server is usually apache or wwrun or httpd or something similar. As a root, you will probably want to execute Moodle CLI scripts like this:&lt;br /&gt;
&lt;br /&gt;
    $ cd /path/to/your/moodle/dir&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/somescript.php --params&lt;br /&gt;
&lt;br /&gt;
Most of the scripts accept common --help (or -h) parameter to display the full usage information, for example:&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/install.php --help&lt;br /&gt;
&lt;br /&gt;
== Upgrading via command line ==&lt;br /&gt;
&lt;br /&gt;
Moodle can be upgraded from the command line. As with the installation script, there is either interactive or non-interactive mode of the upgrade. The script itself does not put the site into the maintenance mode, you have to do it on your own. Also, the script does not backup any data (if you read this page, you probably have some own scripts to backup your moodledata and the database, right?)&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/upgrade.php&lt;br /&gt;
&lt;br /&gt;
Upgrading via command line is a very comfortable way of Moodle upgrade if you use Git checkout of the Moodle source code (see [[Git for Administrators]]). See the following procedure how to upgrade your site within several seconds to the most recent version while preserving your eventual local customizations tracked in git repository:&lt;br /&gt;
&lt;br /&gt;
    $ cd /var/www/sites/moodle/htdocs/&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --enable&lt;br /&gt;
    $ git pull&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/upgrade.php&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --disable&lt;br /&gt;
&lt;br /&gt;
== Installation via command line ==&lt;br /&gt;
&lt;br /&gt;
Since version 2.0, Moodle can be installed from the command line. There are two modes of installation. In interactive mode, the install script asks you for all data needed to properly set up new Moodle site. In non-interactive mode, you must provide all required data as the script parameters and then the new site is installed silently. The parameters can be passed in the interactive mode, too. The provided values are then used as the default values during the interactive session.&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/install.php --lang=cs&lt;br /&gt;
&lt;br /&gt;
== Maintenance mode ==&lt;br /&gt;
&lt;br /&gt;
To switch your site into the maintenance mode via CLI, you can use&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --enable&lt;br /&gt;
&lt;br /&gt;
To turn the maintenance mode off, just execute the same script with --disable parameter.&lt;br /&gt;
&lt;br /&gt;
== Offline mode ==&lt;br /&gt;
&lt;br /&gt;
In some situations, you may want to switch your Moodle site into offline mode so that it is not accessible via the web but you can not stop the web server completely (typically because there are other web pages and applications running there). If a file called &amp;lt;code&amp;gt;climaintenance.html&amp;lt;/code&amp;gt; exists in the root folder of moodledata directory, Moodle will automatically display the contents of that file instead of any other page.&lt;br /&gt;
&lt;br /&gt;
    $ cd /var/www/sites/moodle/moodledata/&lt;br /&gt;
    $ echo &#039;&amp;amp;lt;h1&amp;amp;gt;Sorry, maintenance in progress&amp;amp;lt;/h1&amp;amp;gt;&#039; &amp;amp;gt; climaintenance.html&lt;br /&gt;
&lt;br /&gt;
You can prepare a nice formatted HTML page to inform your users about the server being down and keep in the moodledata directory under a name like &amp;lt;code&amp;gt;climaintenance.off&amp;lt;/code&amp;gt; and rename it to the &amp;lt;code&amp;gt;climaintenance.html&amp;lt;/code&amp;gt; if needed.&lt;br /&gt;
&lt;br /&gt;
== Custom site defaults ==&lt;br /&gt;
&lt;br /&gt;
During the install and upgrade via CLI, Moodle sets the administration variables to the default values. You can use different defaults. See MDL-17850 for details. Shortly, all you need to do is to add a file &amp;lt;code&amp;gt;local/defaults.php&amp;lt;/code&amp;gt; into your Moodle installation. The format of the file is like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$defaults[&#039;pluginname&#039;][&#039;settingname&#039;] = &#039;settingvalue&#039;; // for plugins&lt;br /&gt;
$defaults[&#039;moodle&#039;][&#039;settingname&#039;] = &#039;settingvalue&#039;;     // for core settings&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These defaults are used during install, upgrade and are also displayed as defaults at the Site administration pages.&lt;br /&gt;
&lt;br /&gt;
== Reset user password ==&lt;br /&gt;
&lt;br /&gt;
If you happen to forget your admin password (or you want to set a password for any other user of your Moodle system), you can use reset_password.php script. The script sets the correctly salted password for the given user.&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/reset_password.php&lt;br /&gt;
&lt;br /&gt;
== MySQL storage engine conversion ==&lt;br /&gt;
&lt;br /&gt;
If you run your Moodle site with MySQL database backend and use the default MyISAM as the storage engine for your tables, you may want to convert them to use some more reliable engine like InnoDB (actually, you should want to switch to PostgreSQL ;-) anyway).&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/mysql_engine.php --engine=InnoDB&lt;br /&gt;
&lt;br /&gt;
== Running cron via command line ==&lt;br /&gt;
&lt;br /&gt;
In versions 1.x, you could execute admin/cron.php either from command line or via the web. Since Moodle 2.0, only admin/cli/cron.php script can be run via command line.&lt;br /&gt;
&lt;br /&gt;
== Scheduled tasks ==&lt;br /&gt;
&lt;br /&gt;
Since Moodle 2.7&lt;br /&gt;
&lt;br /&gt;
Scheduled tasks are automatically run by the cron script above, but the specific tasks which run on each cron iteration are determined by the scheduled tasks configuration. It is possible to override the scheduled tasks configuration and run a single scheduled task immediately using the admin/tool/task/cli/schedule_task.php script. &lt;br /&gt;
&lt;br /&gt;
This script accepts the following arguments:&lt;br /&gt;
&lt;br /&gt;
 --list - list all the known scheduled tasks. The tasks are listed by the class name used to run the task. This class name is required as the argument to the next option in order to run a specific task immediately.&lt;br /&gt;
&lt;br /&gt;
 --execute=&amp;lt;task&amp;gt; - Runs a single scheduled task immediately - regardless of scheduling settings. This will even run disabled tasks. Tasks will still use locking to prevent concurrent execution of the same task - even on clusters. The format of the &amp;lt;task&amp;gt; argument must be the same as returned by the --list option above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; You must escape the &amp;quot;\&amp;quot; with an extra \ when using the --execute command. Take the following for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;php schedule_task.php --list&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will return something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
== List of scheduled tasks (http://yourserver.com/moodle) ==&lt;br /&gt;
\enrol_imsenterprise\task\cron_task                10 * * * * *      ASAP&lt;br /&gt;
\logstore_legacy\task\cleanup_task                 * 5 * * * *       ASAP&lt;br /&gt;
\logstore_standard\task\cleanup_task               * 4 * * * *       Wednesday, November 12, 2014, 4:35 AM&lt;br /&gt;
\mod_forum\task\cron_task                          * * * * * *       ASAP&lt;br /&gt;
\core\task\automated_backup_task                   50 * * * * *      ASAP&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run the first task in that list, you would execute&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;php schedule_task.php --execute=\\enrol_imsenterprise\\task\\cron_task&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Database transfer==&lt;br /&gt;
&lt;br /&gt;
A command line script for [[Database transfer]] may be found in &#039;&#039;admin/tool/dbtransfer/cli/migrate.php&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Update user pictures via command line==&lt;br /&gt;
&lt;br /&gt;
   http://moodle.org/pluginfile.php/143/mod_forum/attachment/926929/updatepics.php &lt;br /&gt;
Tested for 2.3.1+&lt;br /&gt;
&lt;br /&gt;
Place this file in /admin/cli/updatepics.php&lt;br /&gt;
&lt;br /&gt;
How to use:&lt;br /&gt;
Run with &amp;quot;dir&amp;quot; option to specify which directory contains the files.&lt;br /&gt;
&lt;br /&gt;
   .../admin/cli/updatepics.php --dir=PATH_TO_DIR&lt;br /&gt;
&lt;br /&gt;
* File names must be identical to usernames&lt;br /&gt;
&lt;br /&gt;
==Manage MOD&#039;s,Blocks via command line==&lt;br /&gt;
&lt;br /&gt;
Here are two scripts to help you manage your plugins.&lt;br /&gt;
&lt;br /&gt;
   http://tracker.moodle.org/browse/MDL-35736&lt;br /&gt;
&lt;br /&gt;
How to use &amp;quot;manage_blocks.php&amp;quot;:&lt;br /&gt;
place in /admin/cli&lt;br /&gt;
&lt;br /&gt;
hide:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --hide&lt;br /&gt;
&lt;br /&gt;
show:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --show&lt;br /&gt;
&lt;br /&gt;
delete:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --delete&lt;br /&gt;
&lt;br /&gt;
protect:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --protect&lt;br /&gt;
&lt;br /&gt;
unprotect:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --unprotect&lt;br /&gt;
&lt;br /&gt;
(obviously - replace &amp;quot;tag_youtube&amp;quot; with the blockthat you want to remove...)&lt;br /&gt;
&lt;br /&gt;
How to use &amp;quot;manage_mods.php&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
hide:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --hide&lt;br /&gt;
&lt;br /&gt;
show:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --show&lt;br /&gt;
&lt;br /&gt;
delete:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --delete&lt;br /&gt;
&lt;br /&gt;
*Important!&lt;br /&gt;
this script does not delete the relevant folder in /moodle/mod or /moodle/blocks&lt;br /&gt;
&lt;br /&gt;
you have to delete it yourself !&lt;br /&gt;
&lt;br /&gt;
==Update language pack via CLI==&lt;br /&gt;
&lt;br /&gt;
  http://tracker.moodle.org/browse/MDL-35735&lt;br /&gt;
&lt;br /&gt;
Place attached file in /admin/cli&lt;br /&gt;
and simply run it, without any command-line arguments :)&lt;br /&gt;
&lt;br /&gt;
==ReSort course list via CLI==&lt;br /&gt;
&lt;br /&gt;
  http://tracker.moodle.org/browse/MDL-36237&lt;br /&gt;
&lt;br /&gt;
Place attached file in /admin/cli&lt;br /&gt;
and simply run it, without any command-line arguments :)&lt;br /&gt;
&lt;br /&gt;
I import courses every night from an external system, and run this script afterwards&lt;br /&gt;
&lt;br /&gt;
==Purge caches via CLI==&lt;br /&gt;
&lt;br /&gt;
You can purge caches using this script:&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/purge_caches.php&lt;br /&gt;
&lt;br /&gt;
==Tool for converting innodb tables to Barracuda==&lt;br /&gt;
&lt;br /&gt;
Some users upgrading to 2.8 are getting the following MySQL error during the course restoration procedure:&lt;br /&gt;
&lt;br /&gt;
  Row size too large (&amp;gt;8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help.&lt;br /&gt;
&lt;br /&gt;
This is due MySQL default type (Antelope) cannot handle more than 10 text columns. We strongly recommend you change the default type to Barracuda.&lt;br /&gt;
&lt;br /&gt;
We&#039;ve created a tool specially to help users on this database type conversion. Please use the command below to do the change on your database.&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/mysql_compressed_rows.php&lt;br /&gt;
&lt;br /&gt;
[[fr:Administration en ligne de commande]]&lt;br /&gt;
[[de:Administration über Kommandozeile]]&lt;br /&gt;
[[ja:コマンドライン経由の管理]]&lt;br /&gt;
[[es:Administración por línea de comando]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Administration_via_command_line&amp;diff=116951</id>
		<title>Administration via command line</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Administration_via_command_line&amp;diff=116951"/>
		<updated>2015-02-09T07:39:17Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* Tool for converting innodb tables to Barracuda */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
If you have shell access to your web server, you may find various CLI (command line interface) scripts useful during Moodle administration. Core admin CLI tools are located in the &amp;lt;code&amp;gt;admin/cli/*&amp;lt;/code&amp;gt; folder. Other plugins provide their CLI functionality via scripts in their own cli folder. For example, the enrol_db sync script is located in &amp;lt;code&amp;gt;enrol/db/cli/&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid problems with access control, you should run them as the owner of the web server process. It is especially important for CLI installation and upgrade as they create new files in moodledata directory and the web server has to have write access to them. In Linux distributions, the user that runs the web server is usually apache or wwrun or httpd or something similar. As a root, you will probably want to execute Moodle CLI scripts like this:&lt;br /&gt;
&lt;br /&gt;
    $ cd /path/to/your/moodle/dir&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/somescript.php --params&lt;br /&gt;
&lt;br /&gt;
Most of the scripts accept common --help (or -h) parameter to display the full usage information, for example:&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/install.php --help&lt;br /&gt;
&lt;br /&gt;
== Upgrading via command line ==&lt;br /&gt;
&lt;br /&gt;
Moodle can be upgraded from the command line. As with the installation script, there is either interactive or non-interactive mode of the upgrade. The script itself does not put the site into the maintenance mode, you have to do it on your own. Also, the script does not backup any data (if you read this page, you probably have some own scripts to backup your moodledata and the database, right?)&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/upgrade.php&lt;br /&gt;
&lt;br /&gt;
Upgrading via command line is a very comfortable way of Moodle upgrade if you use Git checkout of the Moodle source code (see [[Git for Administrators]]). See the following procedure how to upgrade your site within several seconds to the most recent version while preserving your eventual local customizations tracked in git repository:&lt;br /&gt;
&lt;br /&gt;
    $ cd /var/www/sites/moodle/htdocs/&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --enable&lt;br /&gt;
    $ git pull&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/upgrade.php&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --disable&lt;br /&gt;
&lt;br /&gt;
== Installation via command line ==&lt;br /&gt;
&lt;br /&gt;
Since version 2.0, Moodle can be installed from the command line. There are two modes of installation. In interactive mode, the install script asks you for all data needed to properly set up new Moodle site. In non-interactive mode, you must provide all required data as the script parameters and then the new site is installed silently. The parameters can be passed in the interactive mode, too. The provided values are then used as the default values during the interactive session.&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/install.php --lang=cs&lt;br /&gt;
&lt;br /&gt;
== Maintenance mode ==&lt;br /&gt;
&lt;br /&gt;
To switch your site into the maintenance mode via CLI, you can use&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/maintenance.php --enable&lt;br /&gt;
&lt;br /&gt;
To turn the maintenance mode off, just execute the same script with --disable parameter.&lt;br /&gt;
&lt;br /&gt;
== Offline mode ==&lt;br /&gt;
&lt;br /&gt;
In some situations, you may want to switch your Moodle site into offline mode so that it is not accessible via the web but you can not stop the web server completely (typically because there are other web pages and applications running there). If a file called &amp;lt;code&amp;gt;climaintenance.html&amp;lt;/code&amp;gt; exists in the root folder of moodledata directory, Moodle will automatically display the contents of that file instead of any other page.&lt;br /&gt;
&lt;br /&gt;
    $ cd /var/www/sites/moodle/moodledata/&lt;br /&gt;
    $ echo &#039;&amp;amp;lt;h1&amp;amp;gt;Sorry, maintenance in progress&amp;amp;lt;/h1&amp;amp;gt;&#039; &amp;amp;gt; climaintenance.html&lt;br /&gt;
&lt;br /&gt;
You can prepare a nice formatted HTML page to inform your users about the server being down and keep in the moodledata directory under a name like &amp;lt;code&amp;gt;climaintenance.off&amp;lt;/code&amp;gt; and rename it to the &amp;lt;code&amp;gt;climaintenance.html&amp;lt;/code&amp;gt; if needed.&lt;br /&gt;
&lt;br /&gt;
== Custom site defaults ==&lt;br /&gt;
&lt;br /&gt;
During the install and upgrade via CLI, Moodle sets the administration variables to the default values. You can use different defaults. See MDL-17850 for details. Shortly, all you need to do is to add a file &amp;lt;code&amp;gt;local/defaults.php&amp;lt;/code&amp;gt; into your Moodle installation. The format of the file is like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$defaults[&#039;pluginname&#039;][&#039;settingname&#039;] = &#039;settingvalue&#039;; // for plugins&lt;br /&gt;
$defaults[&#039;moodle&#039;][&#039;settingname&#039;] = &#039;settingvalue&#039;;     // for core settings&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These defaults are used during install, upgrade and are also displayed as defaults at the Site administration pages.&lt;br /&gt;
&lt;br /&gt;
== Reset user password ==&lt;br /&gt;
&lt;br /&gt;
If you happen to forget your admin password (or you want to set a password for any other user of your Moodle system), you can use reset_password.php script. The script sets the correctly salted password for the given user.&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/reset_password.php&lt;br /&gt;
&lt;br /&gt;
== MySQL storage engine conversion ==&lt;br /&gt;
&lt;br /&gt;
If you run your Moodle site with MySQL database backend and use the default MyISAM as the storage engine for your tables, you may want to convert them to use some more reliable engine like InnoDB (actually, you should want to switch to PostgreSQL ;-) anyway).&lt;br /&gt;
&lt;br /&gt;
    $ sudo -u apache /usr/bin/php admin/cli/mysql_engine.php --engine=InnoDB&lt;br /&gt;
&lt;br /&gt;
== Running cron via command line ==&lt;br /&gt;
&lt;br /&gt;
In versions 1.x, you could execute admin/cron.php either from command line or via the web. Since Moodle 2.0, only admin/cli/cron.php script can be run via command line.&lt;br /&gt;
&lt;br /&gt;
== Scheduled tasks ==&lt;br /&gt;
&lt;br /&gt;
Since Moodle 2.7&lt;br /&gt;
&lt;br /&gt;
Scheduled tasks are automatically run by the cron script above, but the specific tasks which run on each cron iteration are determined by the scheduled tasks configuration. It is possible to override the scheduled tasks configuration and run a single scheduled task immediately using the admin/tool/task/cli/schedule_task.php script. &lt;br /&gt;
&lt;br /&gt;
This script accepts the following arguments:&lt;br /&gt;
&lt;br /&gt;
 --list - list all the known scheduled tasks. The tasks are listed by the class name used to run the task. This class name is required as the argument to the next option in order to run a specific task immediately.&lt;br /&gt;
&lt;br /&gt;
 --execute=&amp;lt;task&amp;gt; - Runs a single scheduled task immediately - regardless of scheduling settings. This will even run disabled tasks. Tasks will still use locking to prevent concurrent execution of the same task - even on clusters. The format of the &amp;lt;task&amp;gt; argument must be the same as returned by the --list option above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; You must escape the &amp;quot;\&amp;quot; with an extra \ when using the --execute command. Take the following for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;php schedule_task.php --list&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will return something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
== List of scheduled tasks (http://yourserver.com/moodle) ==&lt;br /&gt;
\enrol_imsenterprise\task\cron_task                10 * * * * *      ASAP&lt;br /&gt;
\logstore_legacy\task\cleanup_task                 * 5 * * * *       ASAP&lt;br /&gt;
\logstore_standard\task\cleanup_task               * 4 * * * *       Wednesday, November 12, 2014, 4:35 AM&lt;br /&gt;
\mod_forum\task\cron_task                          * * * * * *       ASAP&lt;br /&gt;
\core\task\automated_backup_task                   50 * * * * *      ASAP&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To run the first task in that list, you would execute&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;php schedule_task.php --execute=\\enrol_imsenterprise\\task\\cron_task&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Database transfer==&lt;br /&gt;
&lt;br /&gt;
A command line script for [[Database transfer]] may be found in &#039;&#039;admin/tool/dbtransfer/cli/migrate.php&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Update user pictures via command line==&lt;br /&gt;
&lt;br /&gt;
   http://moodle.org/pluginfile.php/143/mod_forum/attachment/926929/updatepics.php &lt;br /&gt;
Tested for 2.3.1+&lt;br /&gt;
&lt;br /&gt;
Place this file in /admin/cli/updatepics.php&lt;br /&gt;
&lt;br /&gt;
How to use:&lt;br /&gt;
Run with &amp;quot;dir&amp;quot; option to specify which directory contains the files.&lt;br /&gt;
&lt;br /&gt;
   .../admin/cli/updatepics.php --dir=PATH_TO_DIR&lt;br /&gt;
&lt;br /&gt;
* File names must be identical to usernames&lt;br /&gt;
&lt;br /&gt;
==Manage MOD&#039;s,Blocks via command line==&lt;br /&gt;
&lt;br /&gt;
Here are two scripts to help you manage your plugins.&lt;br /&gt;
&lt;br /&gt;
   http://tracker.moodle.org/browse/MDL-35736&lt;br /&gt;
&lt;br /&gt;
How to use &amp;quot;manage_blocks.php&amp;quot;:&lt;br /&gt;
place in /admin/cli&lt;br /&gt;
&lt;br /&gt;
hide:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --hide&lt;br /&gt;
&lt;br /&gt;
show:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --show&lt;br /&gt;
&lt;br /&gt;
delete:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --delete&lt;br /&gt;
&lt;br /&gt;
protect:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --protect&lt;br /&gt;
&lt;br /&gt;
unprotect:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=tag_youtube --unprotect&lt;br /&gt;
&lt;br /&gt;
(obviously - replace &amp;quot;tag_youtube&amp;quot; with the blockthat you want to remove...)&lt;br /&gt;
&lt;br /&gt;
How to use &amp;quot;manage_mods.php&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
hide:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --hide&lt;br /&gt;
&lt;br /&gt;
show:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --show&lt;br /&gt;
&lt;br /&gt;
delete:&lt;br /&gt;
../admin/cli/manage_blocks.php --name=game --delete&lt;br /&gt;
&lt;br /&gt;
*Important!&lt;br /&gt;
this script does not delete the relevant folder in /moodle/mod or /moodle/blocks&lt;br /&gt;
&lt;br /&gt;
you have to delete it yourself !&lt;br /&gt;
&lt;br /&gt;
==Update language pack via CLI==&lt;br /&gt;
&lt;br /&gt;
  http://tracker.moodle.org/browse/MDL-35735&lt;br /&gt;
&lt;br /&gt;
Place attached file in /admin/cli&lt;br /&gt;
and simply run it, without any command-line arguments :)&lt;br /&gt;
&lt;br /&gt;
==ReSort course list via CLI==&lt;br /&gt;
&lt;br /&gt;
  http://tracker.moodle.org/browse/MDL-36237&lt;br /&gt;
&lt;br /&gt;
Place attached file in /admin/cli&lt;br /&gt;
and simply run it, without any command-line arguments :)&lt;br /&gt;
&lt;br /&gt;
I import courses every night from an external system, and run this script afterwards&lt;br /&gt;
&lt;br /&gt;
==Purge caches via CLI==&lt;br /&gt;
&lt;br /&gt;
You can purge caches using this script:&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/purge_caches.php&lt;br /&gt;
&lt;br /&gt;
==Tool for converting innodb tables to Barracuda==&lt;br /&gt;
&lt;br /&gt;
Some users upgrading to 2.8 are getting the following MySQL error during the course restoration procedure:&lt;br /&gt;
&lt;br /&gt;
  Row size too large (&amp;gt;8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help.&lt;br /&gt;
&lt;br /&gt;
This is due MySQL default type (Antelope) cannot handle more than 10 text columns. We strongly recommemd you change the default type to Barracuda.&lt;br /&gt;
&lt;br /&gt;
We&#039;ve created a tool specially to help users on this database type conversion. Please use the command below to do the change on your database.&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/mysql_compressed_rows.php&lt;br /&gt;
&lt;br /&gt;
[[fr:Administration en ligne de commande]]&lt;br /&gt;
[[de:Administration über Kommandozeile]]&lt;br /&gt;
[[ja:コマンドライン経由の管理]]&lt;br /&gt;
[[es:Administración por línea de comando]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Reset_course&amp;diff=116517</id>
		<title>Reset course</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Reset_course&amp;diff=116517"/>
		<updated>2014-12-11T08:15:03Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* Gradebook Reset Options */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Reusing activities}}&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
This allows you to empty a course of user data, while retaining the activities and other settings. Please be warned when choosing items you will delete your chosen user data from this course forever!&lt;br /&gt;
&lt;br /&gt;
You can select which user data to remove at a granular level under the categories of General, Roles, Gradebook, Groups and Activity data.&lt;br /&gt;
&lt;br /&gt;
Note: Only users with the [[Capabilities/moodle/course:reset|reset course capability]] (by default managers and teachers) can reset a course.&lt;br /&gt;
&lt;br /&gt;
== How to Reset - step by step ==&lt;br /&gt;
&lt;br /&gt;
# Log in and go to the course area you want to reset&lt;br /&gt;
# Resetting a given activity is irreversible, so ensure that you have taken a Backup of your area including the user data - this is a snapshot and can be reinstated if necessary&lt;br /&gt;
# In your area&#039;s Administration block, click on Reset&lt;br /&gt;
# Click any Show Advanced button to show all options for that category&lt;br /&gt;
# Make your selections based on the options (see below for more on these)&lt;br /&gt;
# Click the Reset button&lt;br /&gt;
# Return to your area and check that things are as you want them.&lt;br /&gt;
&lt;br /&gt;
== General Reset Options ==&lt;br /&gt;
&lt;br /&gt;
You can set a new Course Start Date for the freshly reset course, delete all Calendar events, comments,  course AND activity completion data and user notes attached to the course. Note that course logs are not deleted (See MDL-43274)&lt;br /&gt;
&lt;br /&gt;
(Before you reset)&lt;br /&gt;
You will need to make sure that you back up the information that you have within your course before you reset. When you back up the course make sure that you back it up with the user information. That  way you will have a back up data on the ones that have taken your course before you reset it for another group or department.&lt;br /&gt;
&lt;br /&gt;
== Role Reset Options ==&lt;br /&gt;
&lt;br /&gt;
These Role Reset options allow you to unenrol all users with a particular role within a course (e.g students) as well as remove all role overrides and role assignment specific to the course. This does not affect user role assignments outside the context of the course.&lt;br /&gt;
&lt;br /&gt;
== Gradebook Reset Options ==&lt;br /&gt;
&lt;br /&gt;
The Gradebook reset options allow you to delete all gradebook items and categories and/or delete all recorded grades within the course.&lt;br /&gt;
There are two options for gradebook reset:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Delete all grades&#039;&#039;&#039; -  Removes all grade items within the course. Please note activity grade items are not removed in this option.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Delete all items and categories&#039;&#039;&#039; - Remove all categories and related grade items. &lt;br /&gt;
&lt;br /&gt;
Note that these grades are still recorded against a user&#039;s account.&lt;br /&gt;
&lt;br /&gt;
== Group Reset Options ==&lt;br /&gt;
&lt;br /&gt;
The Group reset options provides you with the ability to delete all groups created in the course and/or remove all users from any groups within the course. &lt;br /&gt;
&lt;br /&gt;
You can also delete all groupings created in the course and/or remove all users from any groupings within the course.&lt;br /&gt;
&lt;br /&gt;
== Activity Reset Options ==&lt;br /&gt;
&lt;br /&gt;
Depending on the activities used within a course, you will be provided with the option to remove the user data associated with these learning objects. This includes responses to Choices, Quiz attempts, Feedback Responses, Forum posts (from selected Forum types), Glossary entries etc.&lt;br /&gt;
&lt;br /&gt;
You can remove all attempts from all quizzes.&lt;br /&gt;
&lt;br /&gt;
For [[Workshop]] you can:&lt;br /&gt;
:delete all submissions&lt;br /&gt;
:delete all assessments&lt;br /&gt;
:switch to the setup phase&lt;br /&gt;
&lt;br /&gt;
You can also specify a new course start date.&lt;br /&gt;
&lt;br /&gt;
[[es:Reiniciar curso]]&lt;br /&gt;
[[fr:Réinitialisation]]&lt;br /&gt;
[[ja:コースのリセット]]&lt;br /&gt;
[[de:Kurs zurücksetzen]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Grade_export&amp;diff=114030</id>
		<title>Grade export</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Grade_export&amp;diff=114030"/>
		<updated>2014-08-07T07:07:52Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* XML file export */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Grades}}Grades can be exported to Excel spreadsheet, OpenDocument spreadsheet, plain text file or XML file.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Grade export is NOT intended for students.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==How to export grades==&lt;br /&gt;
[[Image:Grade export.png|thumb|left|Grade export]]To export grades from the gradebook:&lt;br /&gt;
# Choose an export format from the gradebook dropdown menu.&lt;br /&gt;
# Set options as required.&lt;br /&gt;
# If the course uses groups, select whether to export grades for all participants or for a particular group.&lt;br /&gt;
# Select the grade items to be included. Note that ID numbers are required for all activities for XML file export. An ID number field can be found in the common module settings for each activity.&lt;br /&gt;
# Click the submit button.&lt;br /&gt;
# After previewing the data on the following page, click the download button.&lt;br /&gt;
&lt;br /&gt;
==XML file export==&lt;br /&gt;
&lt;br /&gt;
To export grades to XML file, you need to ensure that:&lt;br /&gt;
* Users have ID numbers (an optional field in the user profile)&lt;br /&gt;
* Activities have ID numbers (an optional field in the common module settings)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Export new or updated grades only&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To export only new or updated grades you need to enable &#039;&#039;&#039;XML File&#039;&#039;&#039; in &#039;&#039;Grades &amp;gt; General settings &amp;gt; Primary grade export methods (gradeexport)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
After this setting has been enabled, the XML File option will then set and use a &amp;quot;last exported&amp;quot; field for every grade. The result will export the records with the &amp;lt;state&amp;gt; tag being identified as new or regraded.&lt;br /&gt;
&lt;br /&gt;
This means the report will track the last exported date. If you export and then try again, it will not show any results because there are no new or updated grades since the last export.&lt;br /&gt;
&lt;br /&gt;
==Default grade export settings==&lt;br /&gt;
&lt;br /&gt;
The grade export display type and grade export decimal points site-wide defaults may be set by an administrator in &#039;&#039;Site administration &amp;gt; Grades &amp;gt; [[General grade settings|General settings]]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==User profile fields export==&lt;br /&gt;
&lt;br /&gt;
In Moodle 2.4 onwards, an administrator can specify user profile fields and custom profile fields to be included in the grade export in &#039;&#039;Site administration &amp;gt; Grades &amp;gt; General settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Grade publishing==&lt;br /&gt;
[[Image:Grade publishing settings.png|thumb|left|Grade publishing settings]]&lt;br /&gt;
Grade publishing is a way of importing and exporting grades via a URL without being logged in to Moodle. Grade publishing is intended for administrators only, due to the security implications.&lt;br /&gt;
&lt;br /&gt;
Grade publishing is disabled by default. It can be enabled by an administrator by checking the gradepublishing box in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Grades &amp;gt; [[General grade settings|General settings]]&#039;&#039;. Users with grade publishing capabilities (normally administrators only) are then provided with grade export publishing settings.&lt;br /&gt;
&lt;br /&gt;
To determine the URL for exporting grades, follow an export format link e.g. XML file, select a user key or &#039;Create a new key&#039; to generate a new one, select other options as required, then click the Submit button. A download URL e.g. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://qa.moodle.net/grade/export/xml/dump.php?id=2&amp;amp;groupid=&amp;amp;itemids=-1&amp;amp;export_letters=&amp;amp;export_feedback=0&amp;amp;updatedgradesonly=0&amp;amp;displaytype=1&amp;amp;decimalpoints=2&amp;amp;key=ed18257297c48d15096dd49c1d09ac06&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; will then be provided.&lt;br /&gt;
&lt;br /&gt;
==Grade export capabilities==&lt;br /&gt;
&lt;br /&gt;
* [[Capabilities/gradeexport/ods:publish|Publish ODS grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/ods:view|Use OpenDocument grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/txt:publish|Publish text file grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/txt:view|Use text file grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/xls:publish|Publish XLS grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/xls:view|Use Excel grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/xml:publish|Publish XML grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/xml:view|Use XML grade export]]&lt;br /&gt;
&lt;br /&gt;
==Tips and tricks==&lt;br /&gt;
*Export grades in a spreadsheet format.  Then copy and paste that information into another file that has  worksheet (&amp;quot;raw grades&amp;quot;). Create other worksheets which are custom reports which take their data from &amp;quot;raw grades&amp;quot;. This works if graded activities are &#039;&#039;&#039;not&#039;&#039;&#039; moved around to different positions in the course. This allows you to create a standard printed report(s). For example a compact landscape report of all students and all grades for each activity, a report of just quizes, another of lessons, another of assignments. A pivot table of students by scores, generated from a report worksheet, which gets its data from the raw data.&lt;br /&gt;
*Mailmerge exported grades into custom documents.  For example, a document that is given to a department to file as a proof of training, with scores for every subject quiz.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[:dev:Gradebook export]] developer documentation&lt;br /&gt;
*[http://www.youtube.com/watch?v=yZcbN_7p2zI Video showing how to export grades in Moodle 1.9]&lt;br /&gt;
&lt;br /&gt;
[[es:Exportar_calificaciones]]&lt;br /&gt;
[[fr:Exportation des notes]]&lt;br /&gt;
[[ja:評定のエクスポート]]&lt;br /&gt;
[[de:Bewertungen exportieren]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Grade_export&amp;diff=114029</id>
		<title>Grade export</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Grade_export&amp;diff=114029"/>
		<updated>2014-08-07T06:41:27Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* XML file export */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Grades}}Grades can be exported to Excel spreadsheet, OpenDocument spreadsheet, plain text file or XML file.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Grade export is NOT intended for students.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==How to export grades==&lt;br /&gt;
[[Image:Grade export.png|thumb|left|Grade export]]To export grades from the gradebook:&lt;br /&gt;
# Choose an export format from the gradebook dropdown menu.&lt;br /&gt;
# Set options as required.&lt;br /&gt;
# If the course uses groups, select whether to export grades for all participants or for a particular group.&lt;br /&gt;
# Select the grade items to be included. Note that ID numbers are required for all activities for XML file export. An ID number field can be found in the common module settings for each activity.&lt;br /&gt;
# Click the submit button.&lt;br /&gt;
# After previewing the data on the following page, click the download button.&lt;br /&gt;
&lt;br /&gt;
==XML file export==&lt;br /&gt;
&lt;br /&gt;
To export grades to XML file, you need to ensure that:&lt;br /&gt;
* Users have ID numbers (an optional field in the user profile)&lt;br /&gt;
* Activities have ID numbers (an optional field in the common module settings)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Export new or updated grades only&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To export only the new or updated grades you need to enable XML File on &lt;br /&gt;
&#039;&#039;Grades &amp;gt; General settings &amp;gt; Primary grade export methods (gradeexport)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
After enable XML File option will then set and use a &amp;quot;last exported&amp;quot; field for every grade. The result in exported records with &#039;&#039;&amp;lt;state&amp;gt;&#039;&#039; tag, being identified as &#039;&#039;new&#039;&#039; or &#039;&#039;regraded&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
This means the report will track last exported date, if you exported once and try to export again it will not show any results, because there&#039;s no new or update grades since last export.&lt;br /&gt;
&lt;br /&gt;
==Default grade export settings==&lt;br /&gt;
&lt;br /&gt;
The grade export display type and grade export decimal points site-wide defaults may be set by an administrator in &#039;&#039;Site administration &amp;gt; Grades &amp;gt; [[General grade settings|General settings]]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==User profile fields export==&lt;br /&gt;
&lt;br /&gt;
In Moodle 2.4 onwards, an administrator can specify user profile fields and custom profile fields to be included in the grade export in &#039;&#039;Site administration &amp;gt; Grades &amp;gt; General settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Grade publishing==&lt;br /&gt;
[[Image:Grade publishing settings.png|thumb|left|Grade publishing settings]]&lt;br /&gt;
Grade publishing is a way of importing and exporting grades via a URL without being logged in to Moodle. Grade publishing is intended for administrators only, due to the security implications.&lt;br /&gt;
&lt;br /&gt;
Grade publishing is disabled by default. It can be enabled by an administrator by checking the gradepublishing box in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Grades &amp;gt; [[General grade settings|General settings]]&#039;&#039;. Users with grade publishing capabilities (normally administrators only) are then provided with grade export publishing settings.&lt;br /&gt;
&lt;br /&gt;
To determine the URL for exporting grades, follow an export format link e.g. XML file, select a user key or &#039;Create a new key&#039; to generate a new one, select other options as required, then click the Submit button. A download URL e.g. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://qa.moodle.net/grade/export/xml/dump.php?id=2&amp;amp;groupid=&amp;amp;itemids=-1&amp;amp;export_letters=&amp;amp;export_feedback=0&amp;amp;updatedgradesonly=0&amp;amp;displaytype=1&amp;amp;decimalpoints=2&amp;amp;key=ed18257297c48d15096dd49c1d09ac06&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; will then be provided.&lt;br /&gt;
&lt;br /&gt;
==Grade export capabilities==&lt;br /&gt;
&lt;br /&gt;
* [[Capabilities/gradeexport/ods:publish|Publish ODS grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/ods:view|Use OpenDocument grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/txt:publish|Publish text file grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/txt:view|Use text file grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/xls:publish|Publish XLS grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/xls:view|Use Excel grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/xml:publish|Publish XML grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/xml:view|Use XML grade export]]&lt;br /&gt;
&lt;br /&gt;
==Tips and tricks==&lt;br /&gt;
*Export grades in a spreadsheet format.  Then copy and paste that information into another file that has  worksheet (&amp;quot;raw grades&amp;quot;). Create other worksheets which are custom reports which take their data from &amp;quot;raw grades&amp;quot;. This works if graded activities are &#039;&#039;&#039;not&#039;&#039;&#039; moved around to different positions in the course. This allows you to create a standard printed report(s). For example a compact landscape report of all students and all grades for each activity, a report of just quizes, another of lessons, another of assignments. A pivot table of students by scores, generated from a report worksheet, which gets its data from the raw data.&lt;br /&gt;
*Mailmerge exported grades into custom documents.  For example, a document that is given to a department to file as a proof of training, with scores for every subject quiz.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[:dev:Gradebook export]] developer documentation&lt;br /&gt;
*[http://www.youtube.com/watch?v=yZcbN_7p2zI Video showing how to export grades in Moodle 1.9]&lt;br /&gt;
&lt;br /&gt;
[[es:Exportar_calificaciones]]&lt;br /&gt;
[[fr:Exportation des notes]]&lt;br /&gt;
[[ja:評定のエクスポート]]&lt;br /&gt;
[[de:Bewertungen exportieren]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Grade_export&amp;diff=114028</id>
		<title>Grade export</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Grade_export&amp;diff=114028"/>
		<updated>2014-08-07T03:58:09Z</updated>

		<summary type="html">&lt;p&gt;Lameze: /* XML file export */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Grades}}Grades can be exported to Excel spreadsheet, OpenDocument spreadsheet, plain text file or XML file.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Grade export is NOT intended for students.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==How to export grades==&lt;br /&gt;
[[Image:Grade export.png|thumb|left|Grade export]]To export grades from the gradebook:&lt;br /&gt;
# Choose an export format from the gradebook dropdown menu.&lt;br /&gt;
# Set options as required.&lt;br /&gt;
# If the course uses groups, select whether to export grades for all participants or for a particular group.&lt;br /&gt;
# Select the grade items to be included. Note that ID numbers are required for all activities for XML file export. An ID number field can be found in the common module settings for each activity.&lt;br /&gt;
# Click the submit button.&lt;br /&gt;
# After previewing the data on the following page, click the download button.&lt;br /&gt;
&lt;br /&gt;
==XML file export==&lt;br /&gt;
&lt;br /&gt;
To export grades to XML file, you need to ensure that:&lt;br /&gt;
* Users have ID numbers (an optional field in the user profile)&lt;br /&gt;
* Activities have ID numbers (an optional field in the common module settings)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Export new or updated grades only&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To export only the new or updated grades you need to enable XML File on &lt;br /&gt;
&#039;&#039;Grades &amp;gt; General settings &amp;gt; Primary grade export methods (gradeexport)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
After enable XML File option will then set and use a &amp;quot;last exported&amp;quot; field for every grade. &lt;br /&gt;
&lt;br /&gt;
This might result in exported records with &#039;&#039;&amp;lt;state&amp;gt;&#039;&#039; tag, being identified as &#039;&#039;new&#039;&#039; or &#039;&#039;regraded&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Default grade export settings==&lt;br /&gt;
&lt;br /&gt;
The grade export display type and grade export decimal points site-wide defaults may be set by an administrator in &#039;&#039;Site administration &amp;gt; Grades &amp;gt; [[General grade settings|General settings]]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==User profile fields export==&lt;br /&gt;
&lt;br /&gt;
In Moodle 2.4 onwards, an administrator can specify user profile fields and custom profile fields to be included in the grade export in &#039;&#039;Site administration &amp;gt; Grades &amp;gt; General settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Grade publishing==&lt;br /&gt;
[[Image:Grade publishing settings.png|thumb|left|Grade publishing settings]]&lt;br /&gt;
Grade publishing is a way of importing and exporting grades via a URL without being logged in to Moodle. Grade publishing is intended for administrators only, due to the security implications.&lt;br /&gt;
&lt;br /&gt;
Grade publishing is disabled by default. It can be enabled by an administrator by checking the gradepublishing box in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Grades &amp;gt; [[General grade settings|General settings]]&#039;&#039;. Users with grade publishing capabilities (normally administrators only) are then provided with grade export publishing settings.&lt;br /&gt;
&lt;br /&gt;
To determine the URL for exporting grades, follow an export format link e.g. XML file, select a user key or &#039;Create a new key&#039; to generate a new one, select other options as required, then click the Submit button. A download URL e.g. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://qa.moodle.net/grade/export/xml/dump.php?id=2&amp;amp;groupid=&amp;amp;itemids=-1&amp;amp;export_letters=&amp;amp;export_feedback=0&amp;amp;updatedgradesonly=0&amp;amp;displaytype=1&amp;amp;decimalpoints=2&amp;amp;key=ed18257297c48d15096dd49c1d09ac06&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; will then be provided.&lt;br /&gt;
&lt;br /&gt;
==Grade export capabilities==&lt;br /&gt;
&lt;br /&gt;
* [[Capabilities/gradeexport/ods:publish|Publish ODS grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/ods:view|Use OpenDocument grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/txt:publish|Publish text file grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/txt:view|Use text file grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/xls:publish|Publish XLS grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/xls:view|Use Excel grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/xml:publish|Publish XML grade export]]&lt;br /&gt;
* [[Capabilities/gradeexport/xml:view|Use XML grade export]]&lt;br /&gt;
&lt;br /&gt;
==Tips and tricks==&lt;br /&gt;
*Export grades in a spreadsheet format.  Then copy and paste that information into another file that has  worksheet (&amp;quot;raw grades&amp;quot;). Create other worksheets which are custom reports which take their data from &amp;quot;raw grades&amp;quot;. This works if graded activities are &#039;&#039;&#039;not&#039;&#039;&#039; moved around to different positions in the course. This allows you to create a standard printed report(s). For example a compact landscape report of all students and all grades for each activity, a report of just quizes, another of lessons, another of assignments. A pivot table of students by scores, generated from a report worksheet, which gets its data from the raw data.&lt;br /&gt;
*Mailmerge exported grades into custom documents.  For example, a document that is given to a department to file as a proof of training, with scores for every subject quiz.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[:dev:Gradebook export]] developer documentation&lt;br /&gt;
*[http://www.youtube.com/watch?v=yZcbN_7p2zI Video showing how to export grades in Moodle 1.9]&lt;br /&gt;
&lt;br /&gt;
[[es:Exportar_calificaciones]]&lt;br /&gt;
[[fr:Exportation des notes]]&lt;br /&gt;
[[ja:評定のエクスポート]]&lt;br /&gt;
[[de:Bewertungen exportieren]]&lt;/div&gt;</summary>
		<author><name>Lameze</name></author>
	</entry>
</feed>