Note: You are currently viewing documentation for Moodle 2.2. Up-to-date documentation for the latest stable version is available here: Beginning Moodle 2.0 Administration.

Beginning Moodle 2.0 Administration

From MoodleDocs

The pages began life with the Beginning v1.9 Administration FAQ pages but are aimed specifically at Moodle 2.0. Many of the solutions to problems will work in both versions of Moodle so if you do not find something here, then you may find it in the other pages.


I am being told that I need the intl php plugin to continue to install Moodle 2.0

The intl.dll from Zend is part of the PHP 5.2.8 release and later. It is aimed at improving the internationalization of php pages and Moodle 2.0 uses it as part of this process. If your install is on a local machine or network, then you can download the latest version of PHP and update your PHP. You then have to uncomment all the required dynamic extensions you need, including the php_intl.dll extension. The problem is then solved. If the install is on a host server, then you need to contact your host and ask them to do the same, As an alternative, you can unzip/untar the download file, copy and paste the intl.dll file to your php/ext folder and include the line:

 extension=php_intl.dll

in the Dynamic Extensions section of your php.ini file.

You can also set the error level using:

 intl.error_level = E_WARNING 

but this is not essential

If you are using a Linux install, use your system package manager or specify compilation flag.

   * Debian 5.0 (& Ubuntu) use: apt-get install php-intl or apt-get install php5-intl 
   * CentOS 5.5 (& RedHat) you should (probably) be using php 5.3 from remi and then use: yum install php-intl

This technique can be applied to any updated dynamic extension from Zend. You may want to use later dll files in your php/ext folder, you can do so by doing the same as above, but be careful, your version may not be able to take full advantage of the extension, or some very new extensions may cause an unexpected instability. The best option is still to update on a regular basis, perhaps once a year or so for the PHP.

What Dynamic Extensions do I really need uncommented in my php.ini file? What else do I need to change?

This assumes you have complete control over the installation and running of your server, if your Moodle is hosted, you need to do something different, which is also discussed below. In the php.ini you need to delete the semi-colon, the ;, from the start of any line to uncomment it. For Moodle, you really should only need to change some values, and make sure the extensions you require are available. These are:

Resource Limits

 memory_limit = 128M     //This is the maximum it requires and on a shared server you may get much less. 

Data Handling

 post_max_size = 512M    //This allows postings of up to 512MB, but set it to suit yourself and your circumstances

Paths and Directories

 doc_root ="driveletter:\path\to\server\active\web\directory"  (e.g. d:\Apache\htdocs or e:\iis\wwwroot )
 and
 extension_dir = "driveletter:\path\to\php\ext" (e.g. d:\php\ext or e:\iis\php\ext)

File Uploads

 upload_max_filesize = 512M    (This is different from the post_max_size this is for file uploads.)

Dynamic Extensions

PHP 5.2.x (Moodle 1.9 with additions) PHP 5.3.x
 extension=php_curl.dll
 extension=php_exif.dll
 extension=php_gd2.dll
 extension=php_gettext.dll
 extension=php_imap.dll
 extension=php_ldap.dll
 extension=php_mbstring.dll
 extension=php_mcrypt.dll
 extension=php_mssql.dll
 extension=php_mysql.dll
 extension=php_mysqli.dll
 extension=php_openssl.dll
 extension=php_soap.dll
 extension=php_sockets.dll
 extension=php_sqlite.dll
 extension=php_xmlrpc.dll
 extension=php_intl.dll
 extension=php_zip.dll  ; Added Extensions
 extension=php_curl.dll
 extension=php_gd2.dll
 extension=php_gettext.dll
 extension=php_intl.dll
 extension=php_imap.dll
 extension=php_ldap.dll
 extension=php_mbstring.dll
 extension=php_exif.dll      ; Must be after mbstring as it depends on it
 extension=php_mysql.dll
 extension=php_mysqli.dll
 extension=php_openssl.dll
 extension=php_pdo_mssql.dll
 extension=php_pdo_mysql.dll
 extension=php_soap.dll
 extension=php_sockets.dll
 extension=php_sqlite.dll
 extension=php_xmlrpc.dll
 extension=php_zip.dll
NOTE: If you are using a PHP version earlier than v5.2.8, then for Moodle 2.0.x please add the Dynamic extensions of intl.dll and zip.dll as outlined above. Be aware this structure does not work in Moodle 2.1.

These edits and Dynamic extensions cover a range of options here, there are a number of other possibilities, but these listed are the most common ones. Unless you have a specific need, there may not be any reason to deviate from these settings, but if you do, make sure you know what is going to happen. These extensions will also allow you to successfully install and run many other PHP applications.

One example is the Oracle extensions are not shown here, but Oracle can be used for the Moodle database. Another area people often get themselves into trouble is using "Magic quotes". Magic quotes really should be set to off, they were only introduced early in the use of PHP to allow for some inexperienced scripting practices, (read poor, shoddy or dodgy here). If someone is still writing poor scripts, then they deserve to draw attention to themselves and their scripts deleted.

My Host took my Moodle 2 down from the server due to an overload of the database.

This happens far too often on shared servers. The additional memory requirements of Moodle 2+ for installation and the additional database storage required is going to make it worse. The best bet is to find a dedicated server, that is the optimum, but reality is that costs do play a large part in making decisions about where a Moodle will be stored. A dedicated server will give you the entire disc space and all the memory on that server to use as you need. A virtual dedicated server means you are sharing with a few other users on a server, possibly as many as 10, but more likely 5 or 6. A shared server mean you are sharing one box with as many of the Host's clientele that can be put onto one server. This means sharing all resources and Moodle's demands get higher as the number of Users increases which affects all other Clients of the Host. There are any number of Moodle Partners who may be willing to host your Moodle, and the Internet also means you are not restricted by national or natural boundaries or currency transactions - politics, oceans and banks have no impact on where you host your Moodle.

Why am I having trouble restoring my existing Moodle 1.9.x courses into Moodle 2.0?

Simply put, the changes in coding between Moodle 1.9.x and Moodle 2.0 are large. Additional security has forced changes to the backup processes. In just looking at the databases there are an additional 60 or more tables, so that creates a number of restoring issues alone. To bring Moodle 1.9.x courses into Moodle 2.0 is a monumental challenge, and full credit to those who are trying it. There is, currently, one commercial Windows based solution but it is not fully successful in its restoration of courses.

NOTE: Moodle 2.0 can backup and restore courses from within itself perfectly, the issue appears to be centred on v1.x.x courses.
UPDATE: Moodle 2.1 was released on July 1, 2011 and can now restore course files from backups made in v1.9.x. Student file restorations are not yet available but are expected to be included in v2.2 to be released November, 2011.

Can 2.x backups be restored into 1.9?

No.

How do I look up the error logs in Moodle 2.0?

First, turn the error logs on, go to

 Site administration ► Development ► Debugging

and set error messages to DEVELOPER: .... Then go to

 Site administration ► Reports ► Logs

set your report options to Home 2.0(Site), All Participants, All Activities or Site Errors, View, Display on Page and then click, "Get these logs". The report should give you something, and you may be able to develop an appropriate response from there.

Do I try to upgrade to Moodle 2.0 or just create a new install?

There is always debate around these issues, but simply put, Moodle 2.0 is a complete re-write of a tried and tested tool. This presents its own challenges, obviously, and those challenges need be met in the best way we can. It is a temptation to go all in and jump to the new tool, but this can be a dangerous practice when dealing with a lot of people who are resistant to change, and the change from Moodle 1.9.x to 2.0 is massive.

 Upgrading to Moodle 2.0 has always been an option, but make sure your environment will meet the newer specifications. 

Consider your own circumstances. Are you starting out on the Moodle journey or have you just been dropped into it? Perhaps you are starting out, and you have no resources or courses and you are building for the next few months when you want it to become a part of your learning centre and a showpiece for your institute. A complete new Moodle 2.x.x install and starting from scratch is most appropriate in this circumstance. All major features work in it and some of the tools are a lot more interesting than for Moodle 1.9.x.

 Don't worry about Moodle 1.9.x, just use the new Moodle 2.x.x and learn it if you are starting from scratch.

If you have been dropped into it, and have a lot of courses, and you need to administer your Moodle 1.9.x as well as look at updating, then the next best option is to install a new Moodle and open it just for your Administrators and Staff. Let them get used to the new interface, develop training courses around the new Moodle, not just for staff but for Users as well. Aim at your staff first, let them learn it then they can be more confident in using the new Moodle when they come to teaching their Users/Students.

 In short, best advice is NOT to install a Moodle 2.0 as a production site without thoroughly testing and training first. 

To install and run more than one Moodle successfully is actually simple. Install your Moodle 2.0 and then go to Site administration > Server > Session handling. Look for the Cookie prefix dialogue and add a value to it. Repeat the exercise in every other Moodle you have on your server, it should all work as it is supposed to - as long as the cookie prefixes are different for every Moodle, of course.

Cookie prefix for Moodle 2.0

Essentially, take your time and not be in too much of a rush if you have to convert your Staff and Learners to a new tool. Let the Staff get used to it first, then you can make the swap any time.

If you do update your v1.9.x to v 2.0, and experience some problems, you may want to consider putting the issues and any error messages into a Moodle Tracker item. If you do, you may be providing information to resolve a number of updating issues for a lot of people.

Well, we want to try and upgrade to test our systems.

Try, by all means. However, there are a couple of issues you may need be aware of.

A rough guide and checklist:

  1. Plugins that work in Moodle 1.9.x may not be updated to Moodle 2.0. Check your plugins. Are you using any non-core plugins?
  2. Can you remove any non-core plugins?
  3. Have you backed up your database?
  4. Have you backed up your moodledata folder?
  5. Have you allocated additional time make the update, as a contingency?

You may not necessarily have to remove the non-core plugins from the Moodle, or, they may still be present in the database even if you have deleted them from your Moodle Mod folder. The issue arising is that some plugins appear to be causing update errors as there is no matching core plugin from Moodle 2.0, or the plugin APIs are different and cannot accommodate the older plugins, or the older plugins that have not been properly maintained, cannot handle the newer environment.

NOTE:This is not meant to be an exhaustive checklist or to scare people off trying to upgrade their v1.9.x to v2.0.x, just be aware that Moodle 2.0 is still a work in progress, as is this checklist.

We have extensively used the Book for parts of our previous Moodle, can we do so for Moodle 2.0?

The really good news is that Petr Skoda (Skodak) has the Maintainer role for the Book plugin/module. Petr announced some time back that when his major coding tasks for Moodle 2.0 had been done, he was taking a short break then he would begin work on updating the Book for Moodle 2.0.

UPDATE: Petr's updating of the Book module is now complete, and is available at the above link. Initial testing shows it installs easily and seems to run faster than the original. Seems the code has been better optimized by Petr, who deserves a hearty congratulations!!!

That is OK for the Book, but what about other plugins and blocks?

As a general rule-of-thumb, if a plugin or block has not been maintained through Moodle 1.9.x then it is extremely unlikely it will make it to Moodle 2.0.x. This means the developer has not kept it current and may feel it is too much of a distraction from their current projects to keep active. This does not mean that you, or someone else, may not take it on, as long as you ensure that what you are working with is creative commons, open source or other non-proprietal software and you are not infringing either copyright or intellectual property rights. If you are not sure, try to contact the developer or last maintainer, they may be different - if required, get permission from them to continue development. Of course, you may also seek to develop an entirely new plugin, or block, but it is clear that it is actually duplicating something that already exists or was used in earlier versions of Moodle, but is no longer current. As long as you can prove the provenance of such a plugin or block, and do not use any code from anywhere else that is not original or acknowledged where the code came from, then you should be OK. For ideas and guidelines around developing or updating a plugin, look at this page from Developer Documentation. You can also join a class of developers and learn how it can be done.

I am getting error messages about plugins and the installation stops when upgrading. What do I do?

Quite frequently, not a lot at all, you can just continue on. Many of these messages are just that, messages, they are not supposed to stop or break the installation, they are just warnings that not all is working as you may be used to in an install. Usually they relate to plugins that are not part of Moodle 2.0 yet. Moodle is designed to display a message, but continue on. Or, you can consider that, given the above, upgrading is not really viable and just do a fresh install. If those messages continue, then you have another problem. If there were database errors, or code errors, then it is different, you really do need to stop and investigate.

We are installing Moodle and getting error messages about not using the unicode or UTF-8 charset

In recent times, this has become an issue with CPanel and Fantastico installers on some Linux servers. Apparently the default charset for these tools is a latin_swedish_ci charset. Moodle requires the UTF-8 charset. This is a relatively simple fix, if you have the right tools. Install phpMyAdmin and check it is working, if you do not already have it. You can then go to the SQL page and enter the following code:

 ALTER DATABASE `moodle` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

There have been, in the past, reports of tables that do not change using this SQL code, so try:

 ALTER TABLE `mdl_tablename` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; 

There have been no reasons as to why some tables are missed, but you can alter individual tables by using the code above. The code should look something like:

Changing the charset in Moodle 2.0

This also works in Moodle 1.9.x IF you use the utf8_general_ci charset.

NOTE: This SQL is supposed to work across the database, but recent reports suggest that the ALTER DATABASE seems to have a number of issues stemming from problems with the GRANT command. GRANT [permissiontype] is supposed to allow a user to access the entire database, but it no longer appears to be the case. The ALTER TABLE SQL has not been affected by this issue.

FURTHER NOTE: When using the ALTER DATABASE SQL, it appears to be diverted to altering the db.opt file, but is not continued into the tables of the database. So whether this is a deliberate security feature of more recent editions of MySQL or not is, at this stage, unknown. How this affects Postgres, or Oracle databases is also unknown.

OK, but how can we tell what tables are not converted?

Using phpMyAdmin, you can find out almost anything you like about your database, as long as you know where to look. There is some real documentation about using phpMyAdmin that is linked both in the left and right panels. Go to the Database tab and then select the database you want to look at.

Selecting the database tab in Moodle 2.0

Once selected, you will see what the charset is of each table. Any table that does not comply you can change using the table SQL code above.

Checking the table listings in phpMyAdmin

How do I get and install phpMyAdmin?

phpMyAdmin is another very useful plugin. In Moodle 2.0 the plugin has been updated and is now located in a different place than it was in earlier versions. Go to the phpMyAdmin page in Modules and Plugins and download the Moodle 2.0 version. Unzip it to the moodle/local folder and then go to Notifications. Moodle will then tell you it has been successfully installed. If you look in Administration > Server you will now find a line "phpMyAdmin". To access your database, click the link.

When I update over a 1.9 install, I get an error message about an incompatible plugin and it all stops. What can I do?

One piece of advice is that you just do not do that!

Sometimes, a file/folder will be removed from the code between one version of Moodle and the next. If you upgrade Moodle by copying the new Moodle code over the top of the old code, then the older files not duplicated or no longer existent, or just disused and dropped, will remain, and can break things.

The correct way to upgrade is (assuming your Moodle code is in a folder called moodle on the server:

  1. Upload the new code onto the server into a folder with a temporary name, like moodle_new.
  2. Copy the config.php file from the moodle folder to the moodle_new folder.
  3. For any third-party plugins you have installed, copy the code for them into moodle_new. (Make sure the plugin is compatible with the version of Moodle you are upgrading to.)
  4. Then rename the moodle folder to moodle_old, and then rename moodle_new to moodle.

If you insist though, then you can expect to be getting all sorts of error messages. Given the fundamental changes to the database and the manner in which plugins are structured, and employed, in Moodle 2.0.x this is a very time consuming and, ultimately, futile (I would suggest) approach. You can, of course, remove all non-core plugins, and their corresponding tables from the database, and then you give yourself a chance at getting through it somewhat less scathed, but I doubt it.

What is happening to my uploaded files? I cannot see them in the moodledata folder!

To improve security, Moodle has change how files are stored in the moodledata folder. There are there, but no longer obvious. When a file is uploaded it is given a storage name, an encrypted name, and it is placed into a specific folder within the moodledata folder. That folder's name is directly related to the file storage name. So we have a file with an encrypted name, inside a folder with a related name, inside the moodledata folder. Now comes the nifty part, these encrypted names are used as connections to the database. The database stores those encrypted names as aliases for the files and uses them to link the files to the courses. You see them, but you do not see them, well they are not obvious. Unfortunately, you cannot edit them in place, like you could files in Moodle 1.9.x you have to edit them, delete the older file and upload the new ones.

How do I create a repository?

To setup and use a repository in Moodle 2.0, is not complex, just detailed. What follows will set up a site wide repository, that is the contents of this repository will be available to the entire site - so make sure this is really what you want. This is for the kind of resources you may want to use across a number of courses.

1. In the moodledata folder there is a folder called Repository. Create whatever folders you want in there, but it is suggested you use a consistent naming convention, so everyone knows what type of materials reside there, e.g. CalculusPDFs, EnglishCivilWarDocs, and so on. You can copy the required materials into each folder as you create them or add to it at any time thereafter.

2. In your Moodle 2.0 there are a couple of things you need to do, but first you have to activate the user repository system by going to Site Administration > Plugins >Repositories > Manage Repositories and you will see in the list contained in the right-hand panel an item named "File System". Select the dropdown list box and change the value to "Enabled and visible"

Setting the File System Repository in Moodle 2.0

3. Click the "Settings" link and that will take you to the "Setup repository on file system" page. Click the "Create a Repository Instance" button and this will take you to the next page. On that page you have two text boxes and two buttons. Add the name of the repository you created in the Repository folder and click "Save".

Saving the new Repository in Moodle 2.0

When you return to the "Setup repository on file system" page, you will now see that a list of repositories is available. When you access any course file or image picker, the repository will be available to you under the name you have given it. Any file inside the repository will be available for uploading to your course.

How do I set up a course repository?

Setting up the Course repository is almost exactly the same, but the major difference is that is should only be accessible to that one course.

Create a folder in your moodledata/Repository folder, naming it whatever is relevant. Add the files you want in that repository as you create the folder, or you can add them later.

In the Course Administration menu, click the Repository item which takes you to the "Course Repositories" page. You will see a list of all available Repositories so you can access one of them if you chose, or you can select the Create A Repository Instance, Create a "FileSystem" instance link. This takes you to the same page as shown above.

Creating a new Course Repository in Moodle 2.0

Create your repository instance in the same manner as described above and when you return to the Course Repositories page, you will see your repository listed there.

When you are adding a file to your course from the repository, you can access the stored file from the image or file picker via your repository. The repository is not available outside the course you create it for.

How do I set the maximum upload file size limit?

This is probably the most frequently asked question, and the answer is not that straightforward. The changes that need be made are the same in all versions of Moodle, just in different OS' they need be made in different places. Upload file sizes are restricted in a number of ways and each one in this list restricts the following ones:

 Server level
 Moodle site level
 Course level
 Activity level

Perhaps the best place to find this information is at File upload size There is a full explanation for a number of different OSs but there are a few missing.

This is a contentious issue, mainly because you might think that it should be set inside the Moodle. Unfortunately, this is not so, these are environment issues that need to be set in the server and PHP folders, Moodle cannot work outside itself.

The previous answer is OK if you control the server, but I am hosted, what can I do to override limitations set by my Host?

Before doing this, consult with your host, they may have very different ideas about what your Moodle should be permitted - try not to tread on their toes - they may get annoyed at you breaching your user conditions. In an Apache server, you can create a file called .htaccess which can allow you to override some of the limitations set by PHP on your Moodle. Be aware that this file only applies to your Moodle, and nothing else. Your host will often place a .htaccess file into your root folder which will usually read something like:

 deny from all
 AllowOverride None

These are security related, so there is no need to delete them or otherwise edit them. To overwrite set values in the hosts php.ini file, you may want to use:

 php_value upload_max_filesize 512M
 php_value post_max_size 512M 
 php_value memory_limit 128M

To overwrite boolean or logical settings use:

 php_flag register_globals off

or

 php_flag register_globals 0

Something similar can be done in IIS, but it is a lot more complex.

Thanks Muano

Can I still use the TeX Notation filter in Moodle 2 like I did in Moodle 1.9?

Yes, you can. In fact there is very little that has changed in the changing version. Not that the TeX filter has not be changed, it certainly has, but it does not affect how you will use TeX Notation. It is supposed to be easier to add a third party plugin for TeX, but the relationship between Moodle and such tools as MathJax or Geogebra, or similar tools, is still to be determined.

UPDATE: Mauno Korpelainen has successfully integrated a number of Maths tools onto Moodle. These tools include Geogebra, JSXGraph, Math, MathML, MathTran, tex, DragMath, Geonext, JSQuery, MathJax and if that were not enough, Mauno had also included a version of TinyMCE that has, as native, a Maths editing toolbar. Further information can be found on the Moodle 2 Advanced Maths Tools page.

I want to change our logo and some other images but there seems no clear way of doing it.

Moodle 2 has done things very differently here. Logos and other images are all controlled by the theme. Each theme folder is constructed the same way so it makes it easy to edit. Native Moodle themes use the moodle/pix folder to store common images. Look in there to find the logo for any native theme and that can be replaced by a new logo. Third party themes often use the moodle/theme/pix folder to store images, including logos.

Go and look at the theme folder and in it you will find the name of the theme you are using. In it you will also find the sub-folders for different elements and you should find your layout folder contains most of the instructions for controlling the layout, the Styles folder controls the appearance and so on. Images used in the theme can all be located there as well, in the pix folder.

If you want to use a theme that does not have an image or a logo, just the default icons, then you are talking a serious revamp. For that, you need to look at the Themes 2.0 page.

What about other elements of the Front Page?

In some ways, Moodle 2 has made it easier to setup a front page the way you want it. Different themes will use different defaults, many moving away from the traditional three collumn, blocks, categories/courses, blocks, structure that pervaded Moodle 1.9. The Moodle 2 documentation has a more complete look at the Front page settings than can be viewed here. Also, for a better overview of how this can all be done at a site level, look at the Customising appearance pages.

My Password is not being accepted as valid. How can I login as an Admin?

There are a couple of causes for this problem, but the main one seems to be we forget the jumble of passwords we are required to remember. There are also a number of ways of getting around it, as well.

This discussion covers just about all of them. There are a couple of scripts so be careful and use the right one if you need to.

If you do not wish to use a script, then you can try this: Using phpMyAdmin, enter the database and look for the mdl_users table. The first line of that table's data should be the Guest, and the password for Guest is "guest", without the quote marks. Copy that password and then look for your identity. Paste the "guest" password over the top of yours when you locate it. You should then be able to get into your Moodle then, as an Admin. It has been reported this does not work in every circumstance, but most. To get around that problem you might want to try commenting out the line

 $CFG->passwordsaltmain =

That should then work.

See Also