Installation and Configuration Issues

Date Not Translated

Moodle supports many languages out of the box. If you install an additional language besides the default English, everything is peachy. Except that the date is not translated, if your server does not support the locale.

Here's how to install additional locales on your Debian or Ubuntu server (tested under Debian).

To find out the current locale on the server, simply use the locale command. This will output something like:


To install an additional locale, use dpkg-reconfigure locales. This will open a simple text-based menu which allows you to select all the desired locales and install them.

That's it!


Whenever you upgrade Moodle to a new version, it may require that you do not skip a version. For instance, you cannot upgrade directly from Moodle 1.9 to Moodle 2.4.

Attention: include all the third party plugins during each of those steps! They usually also demand that you do not skip a single upgrade step.


If you have installed a copy of another Moodle installation and something goes wrong, put Moodle into debug mode to facilitate troubleshooting.

In mdl_config, set the record with name = 'debug' to 32767 and the record with name = debugdisplay to 1. So:

UPDATE mdl_config SET value = 32767 WHERE name LIKE 'debug';
UPDATE mdl_config SET value = 1 WHERE name LIKE 'debugdisplay';

Migrating to Another Server: Replace URL

Simply use this tool to replace all the 'old' urls with the new one: /admin/tool/replace/index.php.

Changing All Users' Email Address

For testing purposes, it may be necessary to change the domain of all users' email address.

UPDATE mdl_user SET email = REPLACE(email, SUBSTRING_INDEX(email, '@', -1), '');

About SUBSTRING_INDEX, from the MySQL manual:

Returns the substring from string str before count occurrences of the delimiter delim. If count is positive, everything to the left of the final delimiter (counting from the left) is returned. If count is negative, everything to the right of the final delimiter (counting from the right) is returned.

Optimizing Web Server Performance for Moodle

I have followed most of the recommendations in this series of articles: How to optimize a Moodle server?. The MySQL server is very hard to optimize, even with the advice from the articles. But there are a few good tips about optimizing Apache as well as APC (caching). There are 4 parts, so don't forget to check out parts 2 - 4.

APC Configuration

APC has two modes of operation (or configuration, at least): mmap and shm. By default, mmap is used. But you'll still see some shm configuration settings in use. So, what's the relationship between the two?

Well, if APC is configured with mmap it only uses 1 shm_segment. In that case, you can remove apc.shm_segments from apc.ini (or php.ini, if there's no apc.ini file). Or you can set apc.shm_segments=1.

See also this article: PHP: APC Configuration and Usage Tips and Tricks.

Anonymize All User Data in Moodle

Replace firstname, lastname, email:

UPDATE mdl_user AS u SET u.firstname = 'Test', u.lastname = CONCAT('User',, = CONCAT(CONCAT('Test.User',, ''), u.description = '', u.imagealt = '', u.lastip = '', u.address = '', u.department = '', u.lastnamephonetic = '', u.firstnamephonetic = '', u.alternatename = '', u.middlename = '';

Please note: there could be other columns in your mdl_user table which might be used to identify users, such as country and city.

Use /admin/tool/replace/ to search for a company name that is widely used and replace it with Anonymous Corp.

If you're also working with the platform block (not publicly distributed), then execute this query as well:

UPDATE `mdl_platform_cache` AS pc JOIN mdl_user AS u ON pc.user_id =
SET pc.title = CONCAT( '[user=', pc.user_id, ']', u.firstname, ' ', u.lastname, '[/user]')

To anonymize the username, which frequently contains the actual name:

UPDATE mdl_user AS u SET u.username = CONCAT('test', WHERE u.username NOT LIKE '%admin%';

Personal Tools